Closed astelian closed 1 year ago
@astelian Thank you for your request and the Jira link.
Why do you think that the table index is not used?
SQL is a declarative language. The query execution plan is created at runtime and there is no way of knowing what the execution plan will be. It is up to the database engine to decide. It is possible to make some assumptions, but to a certain extent only. A query execution plan is what contains the complete information.
In #15 comments it has been noted that "INT(11), INT and INTEGER are synonyms" which means that from the point of view of the database engine these represent the same data type. In effect, there shall be no actual cast at runtime.
With reference to the SQL statement examples in ODBC-358, kindly note that a WHERE column IN (...)
query is supposed to be less efficient than WHERE column = value
. The former is a more complex predicate than the latter. CAST is irrelevant here.
If you have evidence (e.g. a query example with a query execution plan) that proves the opposite, please submit that data both here and to ODBC-358.
Thank you.
Hello,
Regarding the issues reported here: https://github.com/mariadb-corporation/mariadb-powerbi/issues/15, doing CAST(column as int) on an already int data type field should not happen, this is actually an real issue when the table has an index on that int column and when filtering it prevents usage of the index. Please can you fix this bug - please see more details here: https://jira.mariadb.org/browse/ODBC-358.
Thanks.