开发者

How to do a fast but innacurate InnoDB row count?

开发者 https://www.devze.com 2023-03-07 23:32 出处:网络
The FAQ of PHPMyAdmin has this to say about its approximate row counts for InnoDB: phpMyAdmin uses a quick method to get the row count, and this method only returns an approximate count in the case

The FAQ of PHPMyAdmin has this to say about its approximate row counts for InnoDB:

phpMyAdmin uses a quick method to get the row count, and this method only returns an approximate count in the case of InnoDB tables.

I would like to use this 'quick method' - but everywhere I sea开发者_开发技巧rch seems to have a different answer.

Does anyone know?


They do this:

SHOW TABLE STATUS LIKE 'foo';

This returns a 'Rows' column. With MyISAM it's 100% accurate, InnoDB just guesses. This is why MyISAM is faster than InnoDB when doing a 'SELECT COUNT(*)' query without a where clause.

phpMyAdmin is open-source, so you can just go into the code and see for yourself!

0

精彩评论

暂无评论...
验证码 换一张
取 消