This topic describes how to use the CHECK TABLE statement.
CHECK TABLE checks a table or tables for errors, especially the tables that failed to be created by executing DDL statements.
- For a sharded table, CHECK TABLE checks whether the underlying physical table shards are complete and whether the columns and indexes of each underlying physical table shard are consistent.
- For a single-database non-sharded table, CHECK TABLE checks whether the table exists.
Syntax
CHECK TABLE tbl_name
Examples
mysql> check table tddl_mgr_log;
+------------------------+-------+----------+----------+
| TABLE | OP | MSG_TYPE | MSG_TEXT |
+------------------------+-------+----------+----------+
| TDDL5_APP.tddl_mgr_log | check | status | OK |
+------------------------+-------+----------+----------+
1 row in set (0.56 sec)
mysql> check table tddl_mg;
+-------------------+-------+----------+----------------------------------------+
| TABLE | OP | MSG_TYPE | MSG_TEXT |
+-------------------+-------+----------+----------------------------------------+
| TDDL5_APP.tddl_mg | check | Error | Table 'tddl5_00.tddl_mg' doesn't exist |
+-------------------+-------+----------+----------------------------------------+
1 row in set (0.02 sec)