SQL SERVER查看索引使用情况
Posted qly2046
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL SERVER查看索引使用情况相关的知识,希望对你有一定的参考价值。
SELECT DISTINCT DB_NAME() AS N\'db_name\' , E.name AS N\'schema_name\' , OBJECT_NAME(a.object_id) AS N\'table_name\' , b.name N\'index_name\' , user_seeks N\'seek\' , user_scans N\'scan\' , last_user_seek , last_user_scan , rows FROM sys.dm_db_index_usage_stats a INNER JOIN sys.indexes b ON a.index_id = b.index_id AND a.object_id = b.object_id INNER JOIN sysindexes c ON c.id = b.object_id INNER JOIN sys.objects D ON D.object_id = b.object_id INNER JOIN sys.schemas E ON D.schema_id = E.schema_id WHERE E.name = \'Finance\' --架构名 --AND OBJECT_NAME(a.object_id) = \'CostCenter\'--表名 AND b.name = \'IX_CostCategory_CnName\' --索引名称 AND rows <> 0;
以上是关于SQL SERVER查看索引使用情况的主要内容,如果未能解决你的问题,请参考以下文章