Jet Profiler says I'm slow....
Hi people,
Hope someone can help me here. I am analyzing my php/mysql project using
JetProfiler, and it warns me of several slow queries. There's one here I would like to figure out with your help.
The table has about 250,000 rows. Users are able to browse through them 20 at a time. The query looks like this:
SELECT * FROM items WHERE CAT='sports' ORDER BY DATUM DESC LIMIT 31900,20
Explain on JetProfiler says: JOIN SIZE 56,841 (VERY BAD,VERY SLOW) using FILESORT (BAD)
Now, obviously this is a google spider browsing through all the items (which is good) so the LIMIT 31900,20 seems to slow it down. Am I right in thinking that with this query it SELECTS about 32000 rows to display the last 20 ? Where does the 56,841 join size come from ?
CAT has a BTREE index (cardinality 48) as well as DATUM (the date).
Is there any other way to select 20 rows, skipping the first 32,000 ?