initial population of repo
This commit is contained in:
6
dmvMissingIdx-19e1becb-0cc5-43c4-acc1-0854d9f98596.json
Normal file
6
dmvMissingIdx-19e1becb-0cc5-43c4-acc1-0854d9f98596.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"id": "19e1becb-0cc5-43c4-acc1-0854d9f98596",
|
||||
"prefix": "dmvMissingIdx",
|
||||
"description": "list possible missing indexes",
|
||||
"body": "-- Missing Indexes for all databases by Index Advantage (Query 22) (Missing Indexes All Databases)\r\nSELECT\tCONVERT(DECIMAL(18, 2), user_seeks * avg_total_user_cost * (avg_user_impact * 0.01)) AS [index_advantage]\r\n\t ,migs.last_user_seek\r\n\t ,mid.[statement] AS [Database.Schema.Table]\r\n\t ,mid.equality_columns\r\n\t ,mid.inequality_columns\r\n\t ,mid.included_columns\r\n\t ,migs.unique_compiles\r\n\t ,migs.user_seeks\r\n\t ,migs.avg_total_user_cost\r\n\t ,migs.avg_user_impact\r\nFROM\tsys.dm_db_missing_index_group_stats AS migs WITH (NOLOCK)\r\n\t\tINNER JOIN sys.dm_db_missing_index_groups AS mig WITH (NOLOCK) ON migs.group_handle = mig.index_group_handle\r\n\t\tINNER JOIN sys.dm_db_missing_index_details AS mid WITH (NOLOCK) ON mig.index_handle = mid.index_handle\r\nORDER BY index_advantage DESC\r\nOPTION\t(RECOMPILE);\r\n\r\n-- Getting missing index information for all of the databases on the instance is very useful\r\n-- Look at last user seek time, number of user seeks to help determine source and importance\r\n-- Also look at avg_user_impact and avg_total_user_cost to help determine importance\r\n-- SQL Server is overly eager to add included columns, so beware\r\n-- Do not just blindly add indexes that show up from this query!!!\r\n"
|
||||
}
|
||||
Reference in New Issue
Block a user