Hi,
select count(*) is very slow in innodb (because it is a table scan). Is there any difference if I change it to select count(column).
I did some test and some times select count(*) is really slow and some time select count(column) is slow. Could anyone help me?
If I need do a select(*) in innodb, is there any way to get away from the slowness?
In the sql, should we avoid doing select * or select count(*)? What is the reason?
The exact row count is stored for MyISAM tables, but not for InnoDB tables. This is the reason for the behavior you see. (For InnoDB, it's not clear *which* count should be stored, given that is uses multi-versioning and multiple transactions may be taking place on the table at any given time.)
If an approximate row count is sufficient, use SHOW TABLE STATUS LIKE 'tbl_name' and look at the value of the Rows output field.
-- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL AB, www.mysql.com
Are you MySQL certified? http://www.mysql.com/certification/
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]