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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:41:12+00:00 2026-06-01T09:41:12+00:00

Say I have a typical customer table; Id Int Identity Primary Key, FirstName varchar(255),

  • 0

Say I have a typical customer table;

Id Int Identity Primary Key, 
FirstName varchar(255), 
LastName varchar(255), 
Phone VarChar(30)

So primary key creates a clustered unique index on Id.

To make searching faster, I want to add indexes to the name fields.

My question is whether I should add the Id to those indexes or will those indexes tie themselves to the primary key anyway.

For instance;

Create Index IX_Customer_FirstLastName On Customers(FirstName, LastName, Id)

… is that overkill?

Is the following more or less efficient?

Create Index IX_Customer_FirstLastName On Customers(FirstName, LastName)

TIA

  • 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-06-01T09:41:13+00:00Added an answer on June 1, 2026 at 9:41 am

    It wouldn’t make sense to add the ID to your other index. It would only be helpful if you had a large number of rows with identical firstName lastName combinations, and you already knew the ID…

    But if you already knew the ID for the records that you’re searching for, you could just search using your clustered index.

    Additionally, every non-clustered index already contains a value for the clustered index so that it can look up the row using the clustered index after it has been found using the non-clustered index. You wouldn’t have to include ID in your non-clustered index if you wanted to make it a covering index for the fields (FirstName, LastName, Id)

    Final note, if you make a single index using FirstName and LastName, this index will only be used on searches that include the FirstName, the leading edge of your index. If you plan on performing searches using just LastName, or just FirstName, create two indexes, one for each column.

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

Sidebar

Related Questions

Say I have a table called Users, which contains your typical information: Id, Name,
Lets say I have a FirstName > MiddleName > LastName hierarchy (~10k rows, for
Say I have a table like so: CREATE TABLE big_table (UUID varchar(32) not null,
Let's say I have the typical entity Car class Car : Entity { public
Lets say have this immutable record type: public class Record { public Record(int x,
Say I have a class definition: class CustomClass { int member; }; Why is
Let's say I have a (fairly typical) set of environments: PROD, UAT, QA, DEV
Let's say I have an edit view that is strongly-typed to a table called
(Note: this is for MS SQL Server) Say you have a table ABC with
Let's say you have a typical web app and with a file configuration.whatever. Every

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.