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