title: SHOW TABLE STATUS summary: TiDB 数据库中 SHOW TABLE STATUS 的使用概况。
SHOW TABLE STATUS
SHOW TABLE STATUS 语句用于显示 TiDB 中表的各种统计信息。如果显示统计信息过期,建议运行 ANALYZE TABLE。
语法图
ShowTableStatusStmt:

FromOrIn:

StatusTableName:

示例
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, c1 INT NOT NULL);
Query OK, 0 rows affected (0.11 sec)
INSERT INTO t1 (c1) VALUES (1),(2),(3),(4),(5);
Query OK, 5 rows affected (0.02 sec)Records: 5 Duplicates: 0 Warnings: 0
SHOW TABLE STATUS LIKE 't1';
*************************** 1. row ***************************Name: t1Engine: InnoDBVersion: 10Row_format: CompactRows: 0Avg_row_length: 0Data_length: 0Max_data_length: 0Index_length: 0Data_free: 0Auto_increment: 30001Create_time: 2019-04-19 08:32:06Update_time: NULLCheck_time: NULLCollation: utf8mb4_binChecksum:Create_options:Comment:1 row in set (0.00 sec)
analyze table t1;
Query OK, 0 rows affected (0.12 sec)
SHOW TABLE STATUS LIKE 't1';
*************************** 1. row ***************************Name: t1Engine: InnoDBVersion: 10Row_format: CompactRows: 5Avg_row_length: 16Data_length: 80Max_data_length: 0Index_length: 0Data_free: 0Auto_increment: 30001Create_time: 2019-04-19 08:32:06Update_time: NULLCheck_time: NULLCollation: utf8mb4_binChecksum:Create_options:Comment:1 row in set (0.00 sec)
MySQL 兼容性
SHOW TABLE STATUS 语句与 MySQL 完全兼容。如发现任何兼容性差异,请在 GitHub 上提交 issue。