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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:04:58+00:00 2026-05-22T01:04:58+00:00

I am designing a Members Table to store the users of a website. It

  • 0

I am designing a Members Table to store the users of a website. It will be used every time a user logs on to the website and occasionally accessed to update user details.

The users will log on with an email address and password and every account will have a unique email address. Therefore it seems logical that the Email column of the Members Table should be it’s clustered index as the majority of queries on this table will be against the Email column as users log on. Making the Email column unique and the key to the clustered index should make querying user’s data as they log on fast and improve performance.

But as I understand it, it would be wrong to make the Email column the Primary Key for two reasons. One, a Primary Key should be constant, so if a user decided to change their email address then all foreign keys would have to be updated and that would be bad. Secondly email addresses are strings which would make Joins slower than if the PK was an int.

So can I make a Non Clustered Index the Primary Key? So that the table has both a Clustered Index with Email as it’s unique key, and an int primary key as a Non Clustered index on top?

Thanks,
Duncan

  • 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-22T01:04:59+00:00Added an answer on May 22, 2026 at 1:04 am

    Primary key is a logical database design and only has to be unique and non-NULL (which is implemented with an index).

    In addition, you have a choice of a single clustered index, which should be narrow, unique, increasing and static (email is probably NOT good for this).

    I would make an IDENTITY int primary key and cluster on that.

    I would add a unique non-clustered index on email and “include” additional columns so that your most frequent heavy queries become covering (i.e. the password hash). Note that you should not need to add the clustered key to the included columns, since that is always included as the bookmark in the non-clustered index).

    Look at the execution plans to ensure that you are not seeing any table scans or clustered index scans in the user table.

    I would add that typically people think that seeing queries use a clustered index is a good thing. I would argue that a non-clustered index scan or seek used in a query where the indexes are covering is just as good on a heap (a table without a clustered index) as on a clustered index and better than a clustered index scan or seek. I would also argue that a clustered index is a name which leads people to all kinds of assumptions about things (to start with, it’s not really an index on a table, it indicates that the table is stored completely in the index structure) and misconceptions about its importance. Clustered indexes are most important in very large operations where a large amount of data is needed in the order of clustering.

    Real (read) query speed on typical OLTP queries comes from covering the query with the narrowest possible non-clustered indexes on all the tables in the query with every column in the appropriate order and correct sort direction for the query/parameters.

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

Sidebar

Related Questions

I'm designing a database for internal use at my company that will store data
Respected Members, I am designing the website in pure HTML with the help of
Im designing a website, and often I need to present information in a nice
while designing my user control, i encountered the following problem: i would like to
Im designing my school's website and I kind of want to do like a
I have this scenario... 1.- I'm providing a Dynamic Table for wich users can
I have been interested in formal methods for some time. I have used formal
I'm designing a website for an organization that's a state chapter of a national
I am designing a website for a small business (landscaping, tree removal, etc) owned
I am designing a list-based app in C# WinForms where I want to store

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.