List:General Discussion« Previous MessageNext Message »
From:Chris Date:January 19 2007 4:18am
Subject:Re: Question about index usage
View as plain text  
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.
Thread
Question about index usageMichaĆ«l de Groot18 Jan
  • Re: Question about index usageChris19 Jan