SHOW STATS_META
你可以通过 SHOW STATS_META
来查看表的总行数以及修改的行数等信息,可以通过 ShowLikeOrWhere 来筛选需要的信息。
目前 SHOW STATS_META
会输出 6 列,具体如下:
列名 | 说明 |
---|---|
db_name | 数据库名 |
table_name | 表名 |
partition_name | 分区名 |
update_time | 更新时间 |
modify_count | 修改的行数 |
row_count | 总行数 |
语法图
ShowStmt
ShowTargetFiltertable
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 语法的扩展。