why the database table TABLES.table_rows column does not match select count(*) from the physical table in MySQL -
when comparing information_schema.tables.table_rows column physical row count retrieved "select count(*) " numbers not match. why row counts different?
mysql> select table_rows tables table_name = 'gbl_session' , table_schema = 'mydb'; +------------+ | table_rows | +------------+ | 7306 | +------------+ 1 row in set (0.01 sec) mysql> select count(*) mydb.gbl_session; +----------+ | count(*) | +----------+ | 7800 | +----------+ 1 row in set (0.01 sec)
for innodb tables, row count rough estimate used in sql optimization. (this true if innodb table partitioned.)
read more information: https://dev.mysql.com/doc/refman/5.1/en/tables-table.html
as comment on there suggests, can try to:
table_rows (and perhaps other columns in information_schema.tables) may out of sync current table contents, can update running analyze.
Comments
Post a Comment