5 ms·
I don't know mysql/mariaDB that well, but I know in ms sql server that doing a DISTINCT on a Function([Column]) would not use an index on [Column]. In this cas
by WorkLifeBalance 8y ago
I don't know mysql/mariaDB that well, but I know in ms sql server that doing a DISTINCT on a Function([Column]) would not use an index on [Column].
In this case it would be much faster to have an intermediate table or column with that statistic that could then be properly indexed.
- bhrgunatha 8y agoIt even has a name - SARGable - able to use an index on the [S]earch [ARG]uments but still easy to get tripped up. https://www.definitions.net/definition/sargable https://www.definitions.net/definition/sargable https://stackoverflow.com/questions/799584/what-makes-a-sql-statement-sargable https://stackoverflow.com/questions/799584/what-makes-a-sql-...
- zamalek 8y agoDepending on the function. The query optimizer is smart enough to recognize many starts-with scenarios, as one example.