View Full Version : use / foce index

12-02-2011, 11:54 PM
Should that affect result of explain ?

It does not.
Neither it affect performance.

Old Pedant
12-03-2011, 12:29 AM
I'm sorry...I don't understand the question.

12-03-2011, 03:58 PM
One of my quryies is slow, so I run explain.

I get:

possible_keys key

mykey NULL

so the key is not used but it should be. Trying to force it has no effect, nor on result of explain nor speed of query

Old Pedant
12-03-2011, 09:59 PM
Ahh...I see.

It's not used because MySQL has decided--for reasons known only to its builders--the it won't be any faster to use it than to not use it.

I can't judge whether reorganizing the data would improve things, because you showed us no details.

I fought with MySQL many many times over stuff like this, and often the only solution is to actually make the query more complex so that MySQL can work on smaller pieces and so use the indexes efficiently.