Michaël de Groot wrote:
> Hi guys,
> I have a question about index usage in MySQL.
> I have a query:
> MYSQL: (root@arson) [webstats]> EXPLAIN SELECT sum(users) as totaal_uniek,
> page_id FROM webstats.stats_hour where page_id LIKE 'vipPage_%' and site =
> 'spelpuntVip' and date > 1166353093 group by page_id ORDER BY totaal_uniek
> DESC LIMIT 10;
How many results does this query return:
select count(*) from webstats.stats_hour where page_id LIKE 'vipPage_%';
How many rows in the table?
It could be that this grabs too many rows and it's easier for mysql to
look at the data rather than the index.
Try an index on (page_id, site, date) and see how that goes.