Last active
October 21, 2015 13:22
-
-
Save robsonalves/253c5ad8799507a16a31 to your computer and use it in GitHub Desktop.
Indexes não utilizados
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
db_name() as DataBaseName | |
,SCHEMA_NAME(O.schema_id) as SchemaNAme | |
,OBJECT_NAME(I.object_id) as TableName | |
,I.Name as IndexName | |
from sys.indexes I | |
inner join sys.objects O on I.object_id = O.object_id | |
left outer join sys.dm_db_index_usage_stats S on S.object_id = I.object_id | |
and I.index_id = S.index_id and database_id = DB_ID() | |
where OBJECTPROPERTY(o.object_id,'IsMsShipped') = 0 | |
and i.name is not null | |
and s.object_id is null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment