Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6574723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:17:48+00:00 2026-05-25T15:17:48+00:00

I found the following SQL intended to help identify missing indexes. I’d like to

  • 0

I found the following SQL intended to help identify missing indexes. I’d like to better understand the output.

   SELECT   migs.avg_total_user_cost * (migs.avg_user_impact / 100.0) * (migs.user_seeks + migs.user_scans) AS ExpectedImprovement
           , DB_NAME(mid.database_id)            AS DBName
           , mid.[object_id]                     AS ObjectID
           , mid.statement                       AS FullyQualifiedObjectName
           , ISNULL (mid.equality_columns,'') +
             CASE WHEN mid.equality_columns IS NOT NULL AND mid.inequality_columns IS NOT NULL THEN
                ','
             ELSE
                ''
             END +
             ISNULL (mid.inequality_columns, '') AS IndexColumns
           , ISNULL (mid.included_columns, '') AS IncludeColumns
           , migs.user_seeks
           , migs.user_scans
           , migs.last_user_seek
           , migs.last_user_scan
      FROM sys.dm_db_missing_index_groups      mig
INNER JOIN sys.dm_db_missing_index_group_stats migs ON migs.group_handle = mig.index_group_handle
INNER JOIN sys.dm_db_missing_index_details     mid  ON mig.index_handle = mid.index_handle
     WHERE migs.avg_total_user_cost * (migs.avg_user_impact / 100.0) * (migs.user_seeks + migs.user_scans) > 10
  ORDER BY migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans) DESC

One of the returned columns is “Include Columns”.

I was wondering if this meant that the column names mentioned should be added to the list of columns in the index or whether there is some other feature to return those presumably high accessed column value without adding them to the index itself. (Perhaps I imagined hearing of such a feature or maybe it was another vendor’s db)

Is the output just suggesting that the list of columns in the index be expanded by the columns mentioned in the “Include Columns” returned value? I am reacting to output suggesting that I add 15 fields to an index and this seems potentially excessive to me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:17:49+00:00Added an answer on May 25, 2026 at 3:17 pm

    SQLServers lets you “include” non-key columns (See details here). The main difference between key columns and non-key columns in the index is that non-key columns are stored only in the leaf level of the index in contrast to key columns which are stored at all levels.

    I wouldn’t recommend to follow advise of your script output (your script is good, don’t get me wrong) literally, i.e. you don’t really have to create all the suggested indexes and include all the columns it wants from you. From my experience SQLServer wants you to make all your query to have a covering index which may affect performance of update/insert and increase database size.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following sql prepared statement: SELECT * FROM video WHERE video_name LIKE
Reading through documentation, I found following: 1.9.1 1.8.4 1.8.2 A version of 1.8.2 select
Found the following in an Oracle-based application that we're migrating (generalized) : SELECT Table1.Category1,
I am using RIA services with Entity Framework- I have the following sql select
In T-SQL you can do following SELECT SUBSTRING(COLUMN1, 1, 3), * FROM TABLE1 But
i found the following article http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx to help me unit test my NHibernate application.
I found the following SQL command: Dim commandText As String = _ UPDATE Sales.Store
I have the following SQL query that performs horribly due to the select count(1)
I am trying to convert the following SQL into NHibernate: SELECT * FROM dbo.Customer
i have in a procedure which fills a table the following sql SELECT NVL(SUM(COL1),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.