SHOW STATS_META

你可以通过 SHOW STATS_META 来查看表的总行数以及修改的行数等信息,可以通过 ShowLikeOrWhere 来筛选需要的信息。

目前 SHOW STATS_META 会输出 6 列,具体如下:

语法元素说明
db_name数据库名
table_name表名
partition_name分区名
update_time更新时间
modify_count修改的行数
row_count总行数

语法图

ShowStmt

ShowStmt

ShowTargetFiltertable

ShowTargetFilterable

ShowLikeOrWhereOpt

ShowLikeOrWhereOpt

示例

show stats_meta;
+---------+------------+----------------+---------------------+--------------+-----------+ | Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count | +---------+------------+----------------+---------------------+--------------+-----------+ | test | t0 | | 2020-05-15 16:58:00 | 0 | 0 | | test | t1 | | 2020-05-15 16:58:04 | 0 | 0 | | test | t2 | | 2020-05-15 16:58:11 | 0 | 0 | | test | s | | 2020-05-22 19:46:43 | 0 | 0 | | test | t | | 2020-05-25 12:04:21 | 0 | 0 | +---------+------------+----------------+---------------------+--------------+-----------+ 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 | +---------+------------+----------------+---------------------+--------------+-----------+ | test | t2 | | 2020-05-15 16:58:11 | 0 | 0 | +---------+------------+----------------+---------------------+--------------+-----------+ 1 row in set (0.00 sec)

MySQL 兼容性

该语句是 TiDB 对 MySQL 语法的扩展。

另请参阅

文档内容是否有帮助?