MySQL Forums
Forum List  »  Newbie

Slow answer when using ORDER BY
Posted by: kennet andersson
Date: March 15, 2009 07:56AM

I have two tables and want to return artists that begins with A,B,C and D

If I use ORDER BY it takaes about 10 times longer to execute compare to not using ORDER BY.


SELECT medialib.guid, medialib.artist, medialib.title
FROM songstation
INNER JOIN medialib ON ( songstation.songguid = medialib.guid )
WHERE (
songstation.stationguid = 'ffeeaab6-9558-4c85-9fc8-27e962d47ec7'
)
AND (
medialib.artist LIKE 'A%'
OR
medialib.artist LIKE 'B%'
OR
medialib.artist LIKE 'C%'
OR
medialib.artist LIKE 'D%'
)

ORDER BY medialib.artist

LIMIT 0 , 30



I have tested BETWEEN, but the result is the same, slower when using ORDER BY.

Any suggestions??



Edited 1 time(s). Last edit at 03/15/2009 07:58AM by kennet andersson.

Options: ReplyQuote


Subject
Written By
Posted
Slow answer when using ORDER BY
March 15, 2009 07:56AM


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.