>I can't index the order by column because it is a dynamic column in a temporary, temporary table that is created on-the-fly by MySQL at the time of execution.
from the query I see, there seems to be nothing dynamic in the tables, I presume it's the query is dynamic?
in that case, you could still have (and keep) the index on that column.
you will need to check out the explain plan, and also check out the mysql system parameters about memory usage for key data...
Main Topics
Browse All Topics





by: fiboPosted on 2009-07-04 at 03:03:51ID: 24776473
Not sure, but I would think that the problem does not really come from the order, but of its combination with LIMIT:
efman/5.0/ en/limit- o ptimizatio n.html
- with limit without order, you proably get the first 10 records that happen to be here
- with limit and order, you first sort the N records, then take the 10
This implies that it handles N records and sorts them in xlog(N) time, while in the other case it handles 10 records and does not sort them
Check http://dev.mysql.com/doc/r