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';
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/
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29254281/viewspace-1403275/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29254281/viewspace-1403275/