ADMIN CHECKSUM TABLE

The ADMIN CHECKSUM TABLE statement calculates a CRC64 checksum for the data and indexes of a table. This statement is used by programs such as TiDB Lightning to ensure that import operations have completed successfully.

Synopsis

AdminStmt
ADMINSHOWDDLJOBSInt64NumWhereClauseOptionalJOBQUERIESNumListTableNameNEXT_ROW_IDSLOWAdminShowSlowCHECKTABLETableNameListINDEXTableNameIdentifierHandleRange,RECOVERINDEXTableNameIdentifierCLEANUPINDEXTableNameIdentifierTABLELOCKTableNameListCHECKSUMTABLETableNameListCANCELDDLJOBSNumListRELOADEXPR_PUSHDOWN_BLACKLISTOPT_RULE_BLACKLISTBINDINGSPLUGINSENABLEDISABLEPluginNameListREPAIRTABLETableNameCreateTableStmtFLUSHCAPTUREEVOLVEBINDINGS
TableNameList
TableName,

Examples

Calculate the checksum for a table:

CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY auto_increment); INSERT INTO t1 VALUES (1),(2),(3); ADMIN CHECKSUM TABLE t1;
mysql> CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY auto_increment); Query OK, 0 rows affected (0.11 sec) mysql> INSERT INTO t1 VALUES (1),(2),(3); Query OK, 3 rows affected (0.02 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> ADMIN CHECKSUM TABLE t1; +---------+------------+----------------------+-----------+-------------+ | Db_name | Table_name | Checksum_crc64_xor | Total_kvs | Total_bytes | +---------+------------+----------------------+-----------+-------------+ | test | t1 | 10909174369497628533 | 3 | 75 | +---------+------------+----------------------+-----------+-------------+ 1 row in set (0.00 sec)

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.