четверг, 3 июня 2010 г.

Индексы которые не использовались с момента последнего презапуска

select o.name,i.name from
(
SELECT x.id,
x.indid
from sys.dm_db_index_usage_stats us
join sys.sysdatabases d on us.database_id = d.dbid
join sys.sysindexes x on us.object_id = x.id and us.index_id = x.indid
join sys.sysobjects o on us.object_id = o.id
where d.name = 'Office'
and o.xtype = 'u' ) used
right outer join sys.sysindexes i on i.id = used.id and i.indid = used.indid
join sysobjects o on o.id=i.id
where o.xtype = 'u'
and used.id is null

Комментариев нет:

Locations of visitors to this page