ITPub博客

首页 > 数据库 > MySQL > 在标准MySQL 5.6上查询没有使用过的索引的SQL

在标准MySQL 5.6上查询没有使用过的索引的SQL

原创 MySQL 作者:壹頁書 时间:2015-01-15 18:14:20 0 删除 编辑
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/

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29254281/viewspace-1403275/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-10-19

  • 博文量
    620
  • 访问量
    6343406