Finding missing indexes in sql server 2005

  • Comments posted to this topic are about the item Finding missing indexes in sql server 2005

  • Thanks for the sql.

    However, why not going through the next step and return the index details at the same time...

    Something like

    SELECT TOP 20 mid.statement as table_name, equality_columns, inequality_columns, included_columns

    , CAST(index_advantage AS INT) AS index_advantage -- cast to hint just to make it more readable

    FROM (

    SELECT (user_seeks+user_scans) * avg_total_user_cost * (avg_user_impact * 0.01) as index_advantage

    , migs.group_handle

    FROM sys.dm_db_missing_index_group_stats migs

    ) as migs_adv,

    sys.dm_db_missing_index_groups mig,

    sys.dm_db_missing_index_details mid

    WHERE migs_adv.group_handle = mig.index_group_handle

    AND mig.index_handle = mid.index_handle

    ORDER BY index_advantage DESC

    😉

  • I'm sorry, a bit in the dark. What does the outcome tell me?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply