查看索引执行次数


declare @dbid int
select @dbid = db_id()
select objectname=object_name(s.object_id), s.object_id, indexname=i.name, i.index_id
            , user_seeks, user_scans, user_lookups, user_updates
from sys.dm_db_index_usage_stats s,
            sys.indexes i
where database_id = @dbid and objectproperty(s.object_id,'IsUserTable') = 1
and i.object_id = s.object_id
and i.index_id = s.index_id
order by (user_seeks + user_scans + user_lookups + user_updates) asc

posted @ 2012-03-22 17:41  Grok.Yao  阅读(227)  评论(0编辑  收藏  举报