I do not understand why MySQL is not using the index for the below query.
I have a table named
users and its create table is
this table contains data.
Now I am running SQL select statements and it's checking its query execution plan.
for the statement
desc select * from users where users.created_at between '2019-05-04' and '2019-05-06';
but which I am using
DateDiff function query is not using indexes.
desc select * from users where DATEDIFF(users.created_at,'2019-05-05 23:11:56.547') = 0;
according to the MySQL documentation page "A function is nondeterministic if, given fixed values for its arguments, it can return different results for different invocations".
According to doc,
DateDiff is a deterministic function and I am not understanding why MySQL is not taking indexes for the query.