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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:29:36+00:00 2026-05-12T10:29:36+00:00

I have a table that potentially will have high number of inserts per second,

  • 0

I have a table that potentially will have high number of inserts per second, and I’m trying to choose a type of primary key I want to use. For illustrative purposes let’s say, it’s users table. I am trying to chose between using GUID and BIGINT as primary key and ultimately as UserID across the app. If I use GUID, I save a trip to database to generate a new ID, but GUID is not “user-friendly” and it’s not possible to partition table by this ID (which I’m planning to do). Using BIGINT is much more convenient, but generating it is a problem – I can’t use IDENTITY (there is a reason fro that), so my only choice is to have some helper table that would contain last used ID and then I call this stored proc:

create proc GetNewID @ID BIGINT OUTPUT
as
begin
update HelperIDTable set @ID=id, id = id + 1 
end

to get the new id. But then this helper table is an obvious bottleneck and I’m concerned with how many updates per second it can do.

I really like the idea of using BIGINT as pk, but the bottleneck problem concerns me – is there a way to roughly estimate how many id’s it could produce per second? I realize it highly depends on hardware, but are there any physical limitations and what degree are we looking at? 100’s/sec? 1000’s/sec?

Any ideas on how to approach the problem are highly appreciated! This problem doesn’t let me sleep for many night now!

Thanks!
Andrey

  • 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-12T10:29:36+00:00Added an answer on May 12, 2026 at 10:29 am

    GUID seem to be a natural choice – and if you really must, you could probably argue to use it for the PRIMARY KEY of the table – the single value that uniquely identifies the row in the database.

    What I’d strongly recommend not to do is use the GUID column as the clustering key, which SQL Server does by default, unless you specifically tell it not to.

    As Kimberly Tripp – the Queen of Indexing – and others have stated a great many times – a GUID as the clustering key isn’t optimal, since due to its randomness, it will lead to massive page and index fragmentation and to generally bad performance.

    Yes, I know – there’s newsequentialid() in SQL Server 2005 and up – but even that is not truly and fully sequential and thus also suffers from the same problems as the GUID – just a bit less prominently so.

    Then there’s another issue to consider: the clustering key on a table will be added to each and every entry on each and every non-clustered index on your table as well – thus you really want to make sure it’s as small as possible. Typically, an INT with 2+ billion rows should be sufficient for the vast majority of tables – and compared to a GUID as the clustering key, you can save yourself hundreds of megabytes of storage on disk and in server memory.

    So to sum it up: unless you have a really good reason, I would always recommend a INT IDENTITY field as the primary / clustered key on your table.

    Marc

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

Sidebar

Related Questions

I have a view defined in SQL server 2008 that joins 4 tables together.
I have an items table in my MySQL database with a DECIMAL(10,2) field called
I have a View Controller that is swapping UIView objects in and out. There
Before delving into the issue, first I will explain the situation. I have two
I have some code that builds SQL queries to perform a lenient, catch-all kind
I have a setup like so on a webpage: Clicking on Add Filter adds
Does MATLAB have any support for hash tables? Some background I am working on
I'm looking to write a tool that aims to convert debug symbols of one
I have an interesting problem, and my logic isn't up to the task. We
At work, we've recently started designing an application to me large scale (we're engineering

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.