sql http://mono.software/2017/07/13/missing-incorrectly-set-up-and-unused-indexes-and-their-impact-o

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql http://mono.software/2017/07/13/missing-incorrectly-set-up-and-unused-indexes-and-their-impact-o相关的知识,希望对你有一定的参考价值。

SELECT
    objects.name AS TableName,
    indexes.name AS IndexName,
    dm_db_index_usage_stats.user_seeks AS UserSeek,
    dm_db_index_usage_stats.user_scans AS UserScans,
    dm_db_index_usage_stats.user_updates AS Writes
FROM
    sys.dm_db_index_usage_stats
    INNER JOIN sys.objects ON dm_db_index_usage_stats.OBJECT_ID = objects.OBJECT_ID
    INNER JOIN sys.indexes ON indexes.index_id = dm_db_index_usage_stats.index_id AND dm_db_index_usage_stats.OBJECT_ID = indexes.OBJECT_ID
WHERE
    indexes.is_primary_key = 0
    AND --remove to show all unused indexes
    dm_db_index_usage_stats.user_updates <> 0
    AND
    dm_db_index_usage_stats.user_seeks = 0
    AND
    dm_db_index_usage_stats.user_scans = 0
ORDER BY
    dm_db_index_usage_stats.user_updates DESC

以上是关于sql http://mono.software/2017/07/13/missing-incorrectly-set-up-and-unused-indexes-and-their-impact-o的主要内容,如果未能解决你的问题,请参考以下文章

sql 2008和sql 2012的区别

sql [sql技巧]一些sql技巧#sql

sql 2008 r2 在sql 2008上兼容么

SQL基础

有大神知道,sql server 中如何批量执行sql语句吗?

pl sql developer怎么执行sql