I have a table that contains at least 60,000 rows. My query is just basic, and it is something like this:
SELECT `table`.name, `table`.age, `table`.points
FROM table
GROUP BY name, age
ORDER BY date
DESC
LIMIT 12
The result is like (12 total, Query took 1.2211 sec), sometimes it even takes 2 seconds to just return 12 rows.
What should be done to make my query faster?
EXPLAIN QUERY:
id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
1 Extra table ALL NULL NULL NULL NULL 65704 Using temporary; Using filesort