Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

My question is: why MySQL does'nt USE the PRIMARY KEY when the first part of the index is a datetime ???
It is very strange since With the same data but consolidated with an INTEGER and TO_DAYS(dateDim) the same request rocks....

This question came from our site for professional and enthusiast programmers.

This is strange indeed. Does the same happens if you use date instead of datetime ?
–
ypercubeDec 30 '11 at 13:38

yes it does exactly the same
–
nemenemsDec 30 '11 at 13:38

1

And if you run WHERE dateDim = DATE('2014-04-03 00:00:00') ?
–
ypercubeDec 30 '11 at 13:43

1

With a reorder of the pk it works. But in facts, I want to make a request with only dateDim and accountDim in the where clause. I use all the pk fields for the case study...
–
nemenemsDec 30 '11 at 13:48