pt-duplicate-key-checker(1) Find duplicate indexes and foreign keys on MySQL tables.

SYNOPSIS

Usage: pt-duplicate-key-checker [OPTIONS] [DSN]

pt-duplicate-key-checker examines MySQL tables for duplicate or redundant indexes and foreign keys. Connection options are read from MySQL option files.


pt-duplicate-key-checker --host host1

RISKS

Percona Toolkit is mature, proven in the real world, and well tested, but all database tools can pose a risk to the system and the database server. Before using this tool, please:
  • Read the tool's documentation
  • Review the tool's known ``BUGS''
  • Test the tool on a non-production server
  • Backup your production server and verify the backups

DESCRIPTION

This program examines the output of SHOW CREATE TABLE on MySQL tables, and if it finds indexes that cover the same columns as another index in the same order, or cover an exact leftmost prefix of another index, it prints out the suspicious indexes. By default, indexes must be of the same type, so a BTREE index is not a duplicate of a FULLTEXT index, even if they have the same columns. You can override this.

It also looks for duplicate foreign keys. A duplicate foreign key covers the same columns as another in the same table, and references the same parent table.

The output ends with a short summary that includes an estimate of the total size, in bytes, that the duplicate indexes are using. This is calculated by multiplying the index length by the number of rows in