If I issue the following commands:
CREATE TABLE foo LIKE bar;
INSERT INTO bar SELECT * FROM foo;
There are several million rows in foo, so this action takes some time.
If I do the following query repeatedly during the execution of the above:
use information_schema
select table_name, TABLE_ROWS from tables where table_name IN ('foo','bar');
I’ve seen the following progression:
+---------------------------------+------------+
| table_name | TABLE_ROWS |
+---------------------------------+------------+
| foo | 21270328 |
| bar | 5292482 |
+---------------------------------+------------+
and then a little later:
+---------------------------------+------------+
| table_name | TABLE_ROWS |
+---------------------------------+------------+
| foo | 21270328 |
| bar | 3422182 |
+---------------------------------+------------+
Why does this number decrease?
As noted in the documentation for information_schema.tables, “For InnoDB tables, the row count is only a rough estimate used in SQL optimization.”