CHECK TABLE
This topic describes how to execute the CHECK TABLE statement.
You can execute the CHECK TABLE statement to check tables. This is suitable for scenarios in which tables may fail to be created by executing DDL statements.
For a sharded table, the CHECK TABLE statement checks the integrity of the physical table shards. The statement also checks whether the columns and indexes of each physical table shard are consistent.
For a non-sharded table, the CHECK TABLE statement checks whether the table exists.
Syntax
CHECK TABLE tbl_name
Examples
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)
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)