Search code examples
mysqldatabasechecksum

Get mysql table checksum using SQL queries


Mysql allows to generate and return table checksum for InnoDB and MyISAM table types. But I'm struggling to find a SQL query to read the already available checksum from the database without creating a new checksum. (I don't want to calculate the checksum by my own as the table is really big)

I'm looking for a query like this.

select checksum(table_name)

Solution

  • MyISAM: For MyISAM tables, if you need to determine checksum frequently, you can create the table with CHECKSUM=1 clause.

    Now, all you need to do is use: CHECKSUM TABLE <table_name> QUICK

    Refer: MySQL CHECKSUM Table Documentation