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 3617258
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:36:04+00:00 2026-05-18T22:36:04+00:00

I ran an execution plan recently and SSMS suggested that I add a non-clustered

  • 0

I ran an execution plan recently and SSMS suggested that I add a non-clustered index to a table.

At first I added the index via the DB Diagram gui. The index that it gave me looked like this:

CREATE NONCLUSTERED INDEX [IX_MyTable] ON [dbo].[MyTable] 
(
    [ID_ForeignKey] ASC,
    [ID] ASC
)

That was not the index that it was looking for. Next I added an index via right click in Object Explorer. I added it to the ID_Foreign key table and on the “Included Columns” page I included the ID column. The index it gave me looked like this:

CREATE NONCLUSTERED INDEX [IX_MyTable] ON [dbo].[MyTable] 
(
    [ID_ForeignKey] ASC
)
INCLUDE ( [ID]) 

That was the index it was looking for.

What’s the difference between these indexes?

  • 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-18T22:36:04+00:00Added an answer on May 18, 2026 at 10:36 pm

    The first creates an index on both columns, that is sorted by the first, and then the second column.

    The second index only sorts on the first column, but also carries with it the data from the second column. This avoids needing to return to the table to get the data for that column.

    The first index will require more computation on inserts and updates, so if you do not need the second column indexed, go with the second version of the index. Both will provide the data you need without having to look it up in the table.

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

Sidebar

Related Questions

I ran into an interesting behavior recently. It seems that if I override .equals()
I have a database table called tbl_event with the non-clustered indexes IDX_Event_Folder and IDX_Event_Time
I ran into the problem that my primary key sequence is not in sync
I am joining a table that has two record id fields (record1, record2) to
I have a query that has a very costly INDEX SEEK operation in the
I ran my integration test and got a list of execution time back. I
I'm running an SSIS package that I made a few months ago, and ran
I have the following Execution statement which creates a table (using data from another
I ran into a problem with Hibernate concerning hql query execution on classes which
Is it possible to configure MySQL so that it has some kind of execution

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.