首页 > 代码库 > SQL SERVER查看索引使用情况
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查看索引使用情况
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。