Re: Slow answer when using ORDER BY
Posted by:
Rick James
Date: March 15, 2009 04:26PM
To speed up this query
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 recommend adding these indexes:
ALTER TABLE songstation
ADD INDEX (stationguid);
ALTER TABLE medialib
DROP INDEX medialib_IndexGUID,
ADD INDEX (guid, artist);
The first one will let it home in on there WHERE on stationguid; the second one should help with the join, and might help with the ORDER BY and LIMIT.
Subject
Written By
Posted
Re: Slow answer when using ORDER BY
March 15, 2009 04:26PM
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.