Advertisement
bytecoded

Cost of Missing Indexes (Tables from TOP 5 Queries by CPU)

Oct 29th, 2019
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.05 KB | None | 0 0
  1. SELECT
  2.     [Total Cost] = ROUND(avg_total_user_cost * avg_user_impact * (user_seeks + user_scans), 0),
  3.     avg_user_impact,
  4.     TableName = statement,
  5.     [EqualityUsage] = equality_columns,
  6.     [InequalityUsage] = inequality_columns,
  7.     [Include COLUMNS] = included_columns
  8.    
  9. FROM sys.dm_db_missing_index_groups g
  10.  
  11.     INNER JOIN sys.dm_db_missing_index_group_stats s
  12.     ON s.group_handle = g.index_group_handle
  13.  
  14.     INNER JOIN sys.dm_db_missing_index_details d
  15.     ON d.index_handle = g.index_handle
  16.    
  17. WHERE
  18.     statement LIKE '%_Document233%'
  19.     OR statement LIKE '%_AccumRgTn11332%'
  20.     OR statement LIKE '%_AccumRgT10549%'
  21.     OR statement LIKE '%_Reference98%'
  22.     OR statement LIKE '%_InfoRg11709%'
  23.     OR statement LIKE '%_Reference21_VT782%'    
  24.     OR statement LIKE '%_InfoRg11710%'
  25.     OR statement LIKE '%_InfoRg11715%'
  26.     OR statement LIKE '%_AccumRgT10349%'
  27.     OR statement LIKE '%_AccumRg10339%'
  28.     OR statement LIKE '%_AccumRgT10337%'
  29.     OR statement LIKE '%_AccumRg14026%'
  30.      
  31. ORDER BY [TableName] ASC, [Total Cost] DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement