[thelist] mysql index not being used in query

Sarah Sweeney mr.sanders at designshift.com
Tue May 10 09:59:10 CDT 2005


> As per your suggestion, I tried:
> 
> EXPLAIN SELECT CategoryID, Title, NodeLeft, NodeRight
>           FROM Categories FORCE INDEX (NodeLR)
>          WHERE NodeLeft BETWEEN 2 AND 1705
>       ORDER BY NodeLeft
> 
> <snip>
> 
> Looks like maybe my only option is to include "FORCE INDEX (NodeLR)" in 
> this query. <sigh>

Turns out that the index is not used in this query because it does not 
limit the results returned enough. If I change the query to "WHERE 
NodeLeft BETWEEN 2 AND 17", it uses the index.


More information about the thelist mailing list