I think TABLE_ROWS
column from information_schema.partitions
table and result of COUNT(*)
have to be same, but in my table, these values are different. Is it possible to be different?
mysql> select partition_name, partition_ordinal_position, table_rows from information_schema.partitions where table_name='lootinfo';
---------------- ---------------------------- ------------
| PARTITION_NAME | PARTITION_ORDINAL_POSITION | TABLE_ROWS |
---------------- ---------------------------- ------------
| future | 3 | 0 |
| p_202206 | 1 | 10676 |
| p_202207 | 2 | 0 |
---------------- ---------------------------- ------------
3 rows in set (0.00 sec)
mysql> select count(*) from lootinfo partition (p_202206);
----------
| count(*) |
----------
| 10360 |
----------
1 row in set (0.00 sec)
I didn't insert or delete any of rows between two queries.
CodePudding user response:
TABLES_ROWS
is an estimate, and COUNT
is the exact number.
According to the docs :
https://dev.mysql.com/doc/mysql-infoschema-excerpt/8.0/en/information-schema-partitions-table.html
For partitioned InnoDB tables, the row count given in the TABLE_ROWS column is only an estimated value used in SQL optimization, and may not always be exact.