Removing duplicate and redundant indexes

You can define several indexes on a column. By mistake, you might have defined the same index again (same column, same order of columns, or same order of keys), which is called a duplicate index. If only partial indexes (leftmost columns) are repetitive, they are called redundant indexes. A duplicate index has no advantages. Redundant indexes might be useful in some cases (a use case is mentioned in the note at the end of this section), but both slow down the inserts. So, it is important to identify and remove them.

There are three tools that can help with finding out duplicate indexes:

  • pt-duplicate-key-checker, which is part of the Percona Toolkit. Installing the Percona Toolkit is covered in Chapter ...

Get MySQL 8 Cookbook 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.