|
| Re: InnoDB and COUNT(*) [message #154 is a reply to message #153 ] |
Thu, 07 September 2006 14:30   |
Peter Messages: 405 Registered: August 2006 |
Senior Member Super Guru |
|
|
Innodb does not store count(*) counter as MyISAM does, this is because it is multi version system and each transaction could have different number of rows visible.
So SELECT COUNT(*) is executed as full table scan or index scan.
If your table is fragmented (physically) it may take quite a while.
SHOW TABLE STATUS LIKE 'table' provides approximate row counter which can be used for some applications. There also other workarounds.
Peter Zaitsev, MySQL Performance Expert
MySQL Performance Blog - http://www.mysqlperformanceblog.com
MySQL Consulting http://www.mysqlperformanceblog.com/mysql-consulting/
|
|
|
|
|