List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:June 28 2002 10:36pm
Subject:Re: InnoDB - count() slow
View as plain text  
In the last episode (Jun 29), Oleg said:
> Hello,
> 
> The query SELECT COUNT(*) FROM table works very slow - for 50 millions
> of records it tooks around 5-10 minutes.
> Is it a bug or a feature?

"Feature".  Innodb tables do not cache the rowcount like MyISAM tables
do, so mysql has to walk the entire table to get a count.  If you have
a unique index, it should be able to scan that instead, which will be
faster.

-- 
	Dan Nelson
	dnelson@stripped
Thread
InnoDB - count() slowOleg28 Jun
  • Re: InnoDB - count() slowDan Nelson29 Jun