SHOW STATS_META

November 10, 2025 ยท View on GitHub

You can use SHOW STATS_META to view how many rows are in a table and how many rows are changed in that table. When using this statement, you can filter the needed information by the ShowLikeOrWhere clause.

Currently, the SHOW STATS_META statement outputs the following columns:

Column nameDescription
Db_nameDatabase name
Table_nameTable name
Partition_namePartition name
Update_timeLast updated time
Modify_countThe number of rows modified
Row_countThe total row count
Last_analyze_timeThe last time the table is analyzed

Note:

The update_time is updated when TiDB updates the modify_count and row_count fields according to DML statements. So update_time is not the last execution time of the ANALYZE statement.

Synopsis

ShowStatsMetaStmt ::=
    "SHOW" "STATS_META" ShowLikeOrWhere?

ShowLikeOrWhere ::=
    "LIKE" SimpleExpr
|   "WHERE" Expression

Examples

SHOW STATS_META;
+---------+------------+----------------+---------------------+--------------+-----------+---------------------+
| Db_name | Table_name | Partition_name | Update_time         | Modify_count | Row_count | Last_analyze_time   |
+---------+------------+----------------+---------------------+--------------+-----------+---------------------+
| test    | t0         |                | 2025-07-27 16:58:00 |            0 |         0 | 2025-07-27 16:58:00 |
| test    | t1         |                | 2025-07-27 16:58:04 |            0 |         0 | 2025-07-27 16:58:04 |
| test    | t2         |                | 2025-07-27 16:58:11 |            0 |         0 | 2025-07-27 16:58:11 |
| test    | s          |                | 2025-07-27 19:46:43 |            0 |         0 | 2025-07-27 19:46:43 |
| test    | t          |                | 2025-07-27 12:04:21 |            0 |         0 | 2025-07-27 12:04:21 |
+---------+------------+----------------+---------------------+--------------+-----------+---------------------+
5 rows in set (0.00 sec)
SHOW STATS_META WHERE table_name = 't2';
+---------+------------+----------------+---------------------+--------------+-----------+---------------------+
| Db_name | Table_name | Partition_name | Update_time         | Modify_count | Row_count | Last_analyze_time   |
+---------+------------+----------------+---------------------+--------------+-----------+---------------------+
| test    | t2         |                | 2025-07-27 16:58:11 |            0 |         0 | 2025-07-27 16:58:11 |
+---------+------------+----------------+---------------------+--------------+-----------+---------------------+
1 row in set (0.00 sec)

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.

See also