SHOW STATS_META

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 6 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

SHOW STATS_META - 图1

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

ShowStmt

ShowStmt

ShowTargetFiltertable

ShowTargetFilterable

ShowLikeOrWhereOpt

ShowLikeOrWhereOpt

Examples

  1. show stats_meta;
  1. +---------+------------+----------------+---------------------+--------------+-----------+
  2. | Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count |
  3. +---------+------------+----------------+---------------------+--------------+-----------+
  4. | test | t0 | | 2020-05-15 16:58:00 | 0 | 0 |
  5. | test | t1 | | 2020-05-15 16:58:04 | 0 | 0 |
  6. | test | t2 | | 2020-05-15 16:58:11 | 0 | 0 |
  7. | test | s | | 2020-05-22 19:46:43 | 0 | 0 |
  8. | test | t | | 2020-05-25 12:04:21 | 0 | 0 |
  9. +---------+------------+----------------+---------------------+--------------+-----------+
  10. 5 rows in set (0.00 sec)
  1. show stats_meta where table_name = 't2';
  1. +---------+------------+----------------+---------------------+--------------+-----------+
  2. | Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count |
  3. +---------+------------+----------------+---------------------+--------------+-----------+
  4. | test | t2 | | 2020-05-15 16:58:11 | 0 | 0 |
  5. +---------+------------+----------------+---------------------+--------------+-----------+
  6. 1 row in set (0.00 sec)

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.

See also