SHOW TABLE STATUS

This statement shows various statistics about tables in TiDB. If the statistics appear out of date, it is recommended to run ANALYZE TABLE.

Synopsis

ShowTableStatusStmt:

ShowTableStatusStmt

FromOrIn:

FromOrIn

StatusTableName:

StatusTableName

Examples

  1. mysql> CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, c1 INT NOT NULL);
  2. Query OK, 0 rows affected (0.11 sec)
  3. mysql> INSERT INTO t1 (c1) VALUES (1),(2),(3),(4),(5);
  4. Query OK, 5 rows affected (0.02 sec)
  5. Records: 5 Duplicates: 0 Warnings: 0
  6. mysql> SHOW TABLE STATUS LIKE 't1'\G
  7. *************************** 1. row ***************************
  8. Name: t1
  9. Engine: InnoDB
  10. Version: 10
  11. Row_format: Compact
  12. Rows: 0
  13. Avg_row_length: 0
  14. Data_length: 0
  15. Max_data_length: 0
  16. Index_length: 0
  17. Data_free: 0
  18. Auto_increment: 30001
  19. Create_time: 2019-04-19 08:32:06
  20. Update_time: NULL
  21. Check_time: NULL
  22. Collation: utf8mb4_bin
  23. Checksum:
  24. Create_options:
  25. Comment:
  26. 1 row in set (0.00 sec)
  27. mysql> analyze table t1;
  28. Query OK, 0 rows affected (0.12 sec)
  29. mysql> SHOW TABLE STATUS LIKE 't1'\G
  30. *************************** 1. row ***************************
  31. Name: t1
  32. Engine: InnoDB
  33. Version: 10
  34. Row_format: Compact
  35. Rows: 5
  36. Avg_row_length: 16
  37. Data_length: 80
  38. Max_data_length: 0
  39. Index_length: 0
  40. Data_free: 0
  41. Auto_increment: 30001
  42. Create_time: 2019-04-19 08:32:06
  43. Update_time: NULL
  44. Check_time: NULL
  45. Collation: utf8mb4_bin
  46. Checksum:
  47. Create_options:
  48. Comment:
  49. 1 row in set (0.00 sec)

MySQL compatibility

The SHOW TABLE STATUS statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also