yarek
asked on
mysql simple ORDER BY optimization
I have a very simple SQL:
select * from members
ORDER BY online,photo DESC
LIMIT 0,12
This takes 4 seconds.
and this other sql :
select * from members
ORDER BY online DESC
LIMIT 0,12
takes less than 1 second
I had a look at
http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html
It seems that you cannot optilmize the sql on 2 keys
Is there another way to optimize this SQL ?
select * from members
ORDER BY online,photo DESC
LIMIT 0,12
This takes 4 seconds.
and this other sql :
select * from members
ORDER BY online DESC
LIMIT 0,12
takes less than 1 second
I had a look at
http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html
It seems that you cannot optilmize the sql on 2 keys
Is there another way to optimize this SQL ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.