DECLARE @dbid INT SELECT @dbid = Db_id('database_name') SELECT d.statement AS table_with_missing_index, s.avg_user_impact, CONVERT(INT, ( unique_compiles + user_seeks + user_scans ) * avg_total_user_cost * ( avg_user_impact )) AS index_advantage, d.equality_columns, d.inequality_columns, d.included_columns, s.avg_total_user_cost, s.unique_compiles, s.user_seeks, s.user_scans, s.last_user_seek FROM sys.dm_db_missing_index_group_stats s, sys.dm_db_missing_index_groups g, sys.dm_db_missing_index_details d WHERE s.group_handle = g.index_group_handle AND d.index_handle = g.index_handle AND database_id = @dbid ORDER BY d.statement, index_advantage DESC, s.avg_user_impact DESC
Friday, 28 December 2012
Script to find out the Missing Indexes in Database :
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment