Re: How can I avoid filesort with BETWEEN and ORDER BY

2004-04-12 Thread Steven Ducat
Donny, Thanks for your answer. I tried your example after adding the necessary index and it works as long as I define a single number not a range (i.e. p_cat.lft = 4). Will keep working on the range part. What I am more interested in is the workarounds that can be made to improve the ORDER BY

RE: How can I avoid filesort with BETWEEN and ORDER BY

2004-04-11 Thread Donny Simonton
Steven, In your case, you query doesn't even use an index. And you are using an order by DESC. Now what I would recommend is something like this, change your query just to test this out. SELECT p.* FROM p_cat c, p_ad p WHERE p.cat = c.id AND c.lft BETWEEN 4 AND 5 ORDER BY p.date DESC LIMIT