MS SQL – Missing Index

SELECT
id.index_handle,
DB_NAME(id.database_id),
id.object_id,
id.statement AS object_name,
gs.avg_user_impact,
gs.avg_total_user_cost,
id.equality_columns,
id.inequality_columns,
id.included_columns,
gs.unique_compiles,
gs.user_seeks,
gs.last_user_seek,
gs.last_system_seek,
gs.user_scans,
gs.last_user_scan,
gs.system_scans
FROM sys.dm_db_missing_index_details AS id
INNER JOIN sys.dm_db_missing_index_groups AS g
ON id.index_handle = g.index_handle
INNER JOIN sys.dm_db_missing_index_group_stats AS gs
ON g.index_group_handle = gs.group_handle
ORDER BY gs.avg_user_impact DESC

Advertisements

About msarm

Aspiring Enterprise Architect.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s