-- 인덱스에대해카운터가되었는지확인
-- Index_id NULL 인경우는인덱스를타지않은경우, NULL 이아닌경우는인덱스를탄경우
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,
--col.name,
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' 카테고리의 다른 글
동적 쿼리2 (0) | 2020.08.27 |
---|---|
누락된 인덱스 정보 확인 (0) | 2020.08.27 |
동적쿼리 (0) | 2020.08.27 |
SQL Server 요일 (0) | 2020.08.27 |
프로시저 생성 권한 부여 (0) | 2020.08.27 |