All Products
Search
Document Center

CHECK TABLE

Last Updated: Jul 31, 2020

This topic describes how to check table errors in Distributed Relational Database Service (DRDS) by executing the CHECK TABLE statement. If a data definition language (DDL) table creation failure occurs, you can execute this statement to check for either of the following points:

  • If the table is partitioned, this SQL statement allows you to check whether any underlying physical table shard is missing and whether the columns and indexes of the underlying physical table are consistent.
  • If the table is a single-database non-partition table, this SQL statement allows you to check whether this table exists.

Syntax:

  1. CHECK TABLE tbl_name
  1. mysql> check table tddl_mgr_log;
  2. +------------------------+-------+----------+----------+
  3. | TABLE | OP | MSG_TYPE | MSG_TEXT |
  4. +------------------------+-------+----------+----------+
  5. | TDDL5_APP.tddl_mgr_log | check | status | OK |
  6. +------------------------+-------+----------+----------+
  7. 1 row in set (0.56 sec)
  8. mysql> check table tddl_mg;
  9. +-------------------+-------+----------+----------------------------------------+
  10. | TABLE | OP | MSG_TYPE | MSG_TEXT |
  11. +-------------------+-------+----------+----------------------------------------+
  12. | TDDL5_APP.tddl_mg | check | Error | Table 'tddl5_00.tddl_mg' doesn't exist |
  13. +-------------------+-------+----------+----------------------------------------+
  14. 1 row in set (0.02 sec)