Index usage on MySQL

When using a date filter in the custom query, metababase generates a query like “DATE(field) BETWEEN …”. This causes any MySQL index in the column “field” to be ignored in the query execution, and thus the query becomes much slower, even using a column with datatype date. How to change that behavior, without going to a text filter?

1 Like

Possibly related existing GitHub issue (with a proposed workaround with creating extra indexes):

1 Like

Oh, man, that is not similar, it is exactly what I needed to see! I just couldn’t type it so I could find it. Thanks for pointing me that.


It a big problem,i use index on other column and make dashboard by sql.

1 Like


yes this is really very bad especially for large tables ! I really cannot understand how this issue has been dragging without being addressed for so long :frowning:

Since Jan 2017:

Since Oct 2017

Currently attempting to find some valid work around with generated coloumns and indexes however i doubt this will suffice.

Would really appriciate if metabase could give some indication of a valid workaround

Gabriel C