Name

CHECKSUM TABLE

Synopsis

CHECKSUM TABLE table[, ...] [QUICK|EXTENDED]

This statement returns a MyISAM table’s live checksum value, a value that can be optionally maintained to improve a table’s repairability. To enable live checksum for a table, use the CREATE TABLE or ALTER TABLE statements with a table option of CHECKSUM=1.

Multiple tables may be given in a comma-separated list. If the QUICK option is employed, the live table checksum will be returned, if available. If not, NULL will be returned. Normally one would use the QUICK option when the table is probably fine. The EXTENDED option instructs the server to check each row. You should use this option only as a last resort. If no option is specified, the QUICK option is the default, if available. If not, the EXTENDED option is the default. The checksum value can be different if the row format changes, which can happen between versions of MySQL. Here is an example of this statement’s use and its results:

CHECKSUM TABLE workreq;

+----------------------+-----------+
| Table                | Checksum  |
+----------------------+-----------+
| workrequests.workreq | 195953487 |
+----------------------+-----------+

Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.