select distinct
mysql.innodb_index_stats.table_name,
mysql.innodb_index_stats.index_name
from
mysql.innodb_index_stats
where
concat(mysql.innodb_index_stats.index_name,
mysql.innodb_index_stats.table_name) not in (select
concat(information_schema.statistics.index_name,
information_schema.statistics.table_name)
from
information_schema.statistics)
and mysql.innodb_index_stats.index_name <> 'GEN_CLUST_INDEX';
参考:
http://www.percona.com/blog/2012/06/30/find-unused-indexes/