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

  • Home
  • SEARCH
  • 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 515121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:35:44+00:00 2026-05-13T07:35:44+00:00

Is it better to use a Guid (UniqueIdentifier) as your Primary/Surrogate Key column, or

  • 0

Is it better to use a Guid (UniqueIdentifier) as your Primary/Surrogate Key column, or a serialized “identity” integer column; and why is it better? Under which circumstances would you choose one over the other?

  • 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-13T07:35:44+00:00Added an answer on May 13, 2026 at 7:35 am

    I personally use INT IDENTITY for most of my primary and clustering keys.

    You need to keep apart the primary key which is a logical construct – it uniquely identifies your rows, it has to be unique and stable and NOT NULL. A GUID works well for a primary key, too – since it’s guaranteed to be unique. A GUID as your primary key is a good choice if you use SQL Server replication, since in that case, you need an uniquely identifying GUID column anyway.

    The clustering key in SQL Server is a physical construct is used for the physical ordering of the data, and is a lot more difficult to get right. Typically, the Queen of Indexing on SQL Server, Kimberly Tripp, also requires a good clustering key to be uniqe, stable, as narrow as possible, and ideally ever-increasing (which a INT IDENTITY is).

    See her articles on indexing here:

    • GUIDs as PRIMARY KEYs and/or the clustering key
    • The Clustered Index Debate Continues…
    • Ever-increasing clustering key – the Clustered Index Debate……….again!

    A GUID is a really bad choice for a clustering key, since it’s wide, totally random, and thus leads to bad index fragmentation and poor performance. Also, the clustering key row(s) is also stored in each and every entry of each and every non-clustered (additional) index, so you really want to keep it small – GUID is 16 byte vs. INT is 4 byte, and with several non-clustered indices and several million rows, this makes a HUGE difference.

    In SQL Server, your primary key is by default your clustering key – but it doesn’t have to be. You can easily use a GUID as your NON-Clustered primary key, and an INT IDENTITY as your clustering key – it just takes a bit of being aware of it.

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

Sidebar

Related Questions

For SQL server is it better to use an uniqueidentifier(GUID) or a bigint for
Which is better to use in PHP, a 2D array or a class? I've
Which approach is better to use if I need a member (sp or func)
Which one is better to use when it come to return value for example
Is better to use the below statement Convert.ToInt32(0 + stringValue) If not then why?
Is it better to use a stored procedure or doing it the old way
Is it better to use NOT or to use <> when comparing values in
Is it better to use NGEN an ASP.NET application when we know it is
Why is it better to use '!= than '<' in a vector loop? I
Is it better to use default null or default for text fields in MySQL?

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.