查看索引使用情况
2011-12-28 11:07
169 查看
索引使用情况信息,存放在sys.dm_db_index_usage_stats 中
--查看索引使用情况
SELECT o.name Object_Name, SCHEMA_NAME(o.schema_id) Schema_name,
i.name Index_name, i.Type_Desc,
s.user_seeks, s.user_scans,
s.user_lookups, s.user_updates
FROM sys.objects AS o
JOIN sys.indexes AS i ON o.object_id = i.object_id
JOIN sys.dm_db_index_usage_stats AS s ON i.object_id = s.object_id
AND i.index_id = s.index_id
WHERE o.type = 'u'
-- Clustered and Non-Clustered indexes
AND i.type IN (1, 2)
-- Indexes that have been updated by not used
AND(s.user_seeks > 0 or s.user_scans > 0 or s.user_lookups > 0 )
order by o.name
--查看索引使用情况
SELECT o.name Object_Name, SCHEMA_NAME(o.schema_id) Schema_name,
i.name Index_name, i.Type_Desc,
s.user_seeks, s.user_scans,
s.user_lookups, s.user_updates
FROM sys.objects AS o
JOIN sys.indexes AS i ON o.object_id = i.object_id
JOIN sys.dm_db_index_usage_stats AS s ON i.object_id = s.object_id
AND i.index_id = s.index_id
WHERE o.type = 'u'
-- Clustered and Non-Clustered indexes
AND i.type IN (1, 2)
-- Indexes that have been updated by not used
AND(s.user_seeks > 0 or s.user_scans > 0 or s.user_lookups > 0 )
order by o.name
相关文章推荐
- PG数据库查看索引使用情况
- mysql 查看索引使用情况
- Mysql查看索引使用情况
- 查看数据库空间页。表空间页。索引空间页。索引碎片。日志空间的使用情况。
- 查看索引的使用情况(show status like 'Handler_read%')
- Sqlserver 2005+:查看索引【index】的【使用情况】:无效的索引、高成本索引
- 查看索引使用的情况
- 查看索引的使用情况
- 查看SQLServer索引的使用情况
- (五)2.3 查看索引使用情况
- 查看索引使用情况
- postgreSQL查看索引的使用情况
- 查看一个表上索引一段时间的使用情况
- MySQL之Handler_read_*查看索引使用情况
- mysql如何查看索引使用情况以及优化 - guols0612
- mysql 查看索引使用情况
- SqlServer中查看索引的使用情况
- sqlserver查看索引使用情况以及建立丢失的索引
- 四、物理优化(7)查看索引使用情况
- linux 查看Java 进程的内存使用情况