cout(*) a Perf Killer?

Hi I just want to aks whether you all can
confirm, that count(*)s from big tables are performance killers?!

I think so because a simple access by primary key takes virtually no time, while a count(*) takes 300ms.


They are instant on myiasm tables, but slower on innodb. tml

Most count(*) performs a range scan on an index.

The only specific case when this is not done is the MyISAM special case when you select count(*) of the entire table. And that is because MyISAM keeps the total nr of rows in the table as meta data for the table.

Best way to keep the time short is to make sure that you have enough RAM and allowing enough memory for caching. That way this index range scan will be performed entirely in RAM which usually is fast enough for most needs.