Henry

曾经沧海难为水,除却巫山不是云,取次花丛懒回顾,半缘修道半缘君。

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1. 统计没用使用过的索引:

如果有聚集索引,则表为B-Tree

如果没有聚集索引,则表为Heap

select b.name ,a.name ,a.index_id,c.object_id from sys.indexes a
inner join sys.tables b
on a.object_id=b.object_id
and a.name is not null
left join sys.dm_db_index_usage_stats c
on a.object_id=c.object_id and c.database_id=db_id()
and c.index_id<>0 --
where c.object_id is null
posted on 2011-06-28 14:54  Henry.Lau  阅读(149)  评论(0编辑  收藏  举报