select object_name( idx.object_id) as 'table',
	idx.name as 'index',
	idx.index_id as 'id',
	idx.type_desc as 'type',
	icol.column_id,
	usg.user_seeks,
	usg.last_user_seek,
	usg.user_scans,
	usg.last_user_scan,
	usg.user_lookups,
	usg.last_user_lookup
from sys.indexes idx inner join sys.dm_db_index_usage_stats usg
	on usg.object_id = idx.object_id and idx.index_id = usg.index_id and usg.database_id = db_id()
	left join sys.index_columns icol on icol.index_id = usg.index_id and icol.object_id = idx.object_id
and usg.index_id IS null
and idx.type_desc not in ('heap','clustered')

 

'Database > Query' 카테고리의 다른 글

Full Scan, Index Scan Query  (0) 2020.08.28
모든 인덱스 다시 리빌드, 통계 업데이트  (0) 2020.08.28
INDEX 정보  (0) 2020.08.28
동적 쿼리2  (0) 2020.08.27
누락된 인덱스 정보 확인  (0) 2020.08.27

+ Recent posts