Don't hide in function

suggest change

A common mistake is to hide an indexed column inside a function call. For example, this can’t be helped by an index:

WHERE DATE(dt) = '2000-01-01'

Instead, given INDEX(dt) then these may use the index:

WHERE dt = '2000-01-01'  -- if `dt` is datatype `DATE`

This works for DATE, DATETIME, TIMESTAMP, and even DATETIME(6) (microseconds):

WHERE dt >= '2000-01-01'
  AND dt  < '2000-01-01' + INTERVAL 1 DAY

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents