Re: Queries using JOIN and ORDER BY LIMIT
Posted by:
Rick James
Date: March 15, 2012 10:50AM
> So if I understand correctly, the only way to improve the query performance is to have the filtering and sorting columns in the same table and create a combined index for them?
Yes. This is because it cannot do the LIMIT until after the SORT (ORDER BY), which cannot start until it has looked at all the rows in both tables.
One possibility -- Maintain (redundantly) another table with _only_ the valid rows.
> Is there anything else that can be done to improve the query time? Are there any new features in MySQL 5.5 or later that would help with this kind of query?
Absolutely not. You have a computationally complex problem; the algorithms were optimized decades ago.
Subject
Views
Written By
Posted
19753
March 10, 2012 01:11PM
2762
March 12, 2012 06:18PM
2607
March 13, 2012 11:07PM
2416
March 14, 2012 08:45AM
Re: Queries using JOIN and ORDER BY LIMIT
2515
March 15, 2012 10:50AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.