ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【sqlserver】 统计索引使用次数

【sqlserver】 统计索引使用次数

原创 Linux操作系统 作者:renjixinchina 时间:2012-08-31 17:50:31 0 删除 编辑
declare @dbid int
select @dbid = db_id()
select bjectname=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

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15747463/viewspace-742392/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-01-30

  • 博文量
    373
  • 访问量
    2161080