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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:37:04+00:00 2026-05-26T12:37:04+00:00

which is better to be used Guid Or Int Primary Key? some search result

  • 0

which is better to be used Guid Or Int Primary Key? some search result favors Guid and other favor Int.
so what are really the pros and cons of each.

  • 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-26T12:37:05+00:00Added an answer on May 26, 2026 at 12:37 pm

    For SQL Server, 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 unique, 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!
    • Disk space is cheap – THAT’S NOT THE POINT

    and also see Jimmy Nilsson’s The Cost of GUIDs as Primary Key

    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

which is better used in MachineKey for 3.5 framework in asp.net? and what is
Which is better? 1. = link_to Page, /page, :class => button, :data => {:theme
which is better or faster, A or B? std::deque<Myclass> queue; ... // do something
Which constitutes better object oriented design? Class User { id {get;set} } Class Office
Which is better? if not var: var = get_var() (or) var = var or
Which is better way to use jQuery() ? I've heard that jQuery(element) doesn't ruin
Which is better in respect to performance and memory utilization? // + Operator oMessage.Subject
Which has better execution performance: CSS3 animations, or jQuery animations? How do they affect
Is there any considerations to determine which is better practice for creating an object
I don't want to make this into a which is better... MVC or WebForms

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.