Skip to content

Find unused indexes in MySQL

Look for indexes with no recorded operations, then check why each index exists before considering removal.

SELECT OBJECT_SCHEMA AS database_name,
OBJECT_NAME AS table_name,
INDEX_NAME AS index_name,
COUNT_STAR AS total_operations,
COUNT_READ AS read_operations
FROM performance_schema.table_io_waits_summary_by_index_usage
WHERE OBJECT_SCHEMA = DATABASE()
AND INDEX_NAME IS NOT NULL
AND INDEX_NAME <> 'PRIMARY'
AND COUNT_STAR = 0
ORDER BY OBJECT_NAME, INDEX_NAME;

The result identifies review candidates. Zero operations means zero recorded use during the available statistics period.

Restarts, counter resets, and index changes can erase earlier activity. Server uptime does not establish when an index’s counters were last reset. MySQL describes the reset behavior in its index I/O summary reference.

  1. Run the SQL in the query editor on the target database.
  2. Open Admin › Indexes.
  3. Inspect each candidate’s columns, uniqueness, and definition.
  4. Check its role in the workload and constraints using the list below.

Before changing an index, confirm that:

  • Statistics collection was active throughout a representative workload period.
  • The period includes infrequent jobs, such as month-end reports.
  • The index does not enforce a unique constraint.
  • Foreign keys do not depend on it.
  • Query plans still have suitable indexes for important statements.

Use change structure to review proposed index changes and their SQL.

The account needs SELECT access to performance_schema.table_io_waits_summary_by_index_usage. Performance Schema must collect table I/O events for the tables under review.

For missing or empty statistics, use Admin data troubleshooting. Ask the administrator when collection began and whether counters were reset.

Use find slow queries to review workload evidence and table size for aggregate index storage. Return to the MySQL overview.