Skip to content

Instantly share code, notes, and snippets.

@jayjanssen
Created July 6, 2012 16:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jayjanssen/3061311 to your computer and use it in GitHub Desktop.
Save jayjanssen/3061311 to your computer and use it in GitHub Desktop.
Find pt-table-checksum diffs that are not MEMORY tables and in a specific schema
SELECT db, tbl, SUM(this_cnt) AS total_rows, COUNT(*) AS chunks
FROM percona.checksums, information_schema.tables
WHERE
percona.checksums.db=information_schema.tables.TABLE_SCHEMA AND
percona.checksums.tbl=information_schema.tables.TABLE_NAME AND
information_schema.tables.ENGINE != 'MEMORY' AND
percona.checksums.db='myDB' AND
(
master_cnt <> this_cnt
OR master_crc <> this_crc
OR ISNULL(master_crc) <> ISNULL(this_crc))
GROUP BY db, tbl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment