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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:21:48+00:00 2026-05-10T17:21:48+00:00

Has someone ever measured performance of Sequential Guid vs. Standard Guid when used as

  • 0

Has someone ever measured performance of Sequential Guid vs. Standard Guid when used as Primary Keys inside a database?


I do not see the need for unique keys to be guessable or not, passing them from a web UI or in some other part seems a bad practice by itself and I do not see, if you have security concerns, how using a guid can improve things (if this is the matter use a real random number generator using the proper crypto functions of the framework).
The other items are covered by my approach, a sequential guid can be generated from code without need for DB access (also if only for Windows) and it’s unique in time and space.
And yes, question was posed with the intent of answering it, to give people that have choosen Guids for their PK a way to improve database usage (in my case has allowed the customers to sustain a much higher workload without having to change servers).

It seems that security concerns are a lot, in this case do not use Sequential Guid or, better still, use standard Guid for PK that are passed back and forward from your UI and sequential guid for everything else. As always there is no absolute truth, I’ve edited also main answer to reflect this.

  • 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. 2026-05-10T17:21:49+00:00Added an answer on May 10, 2026 at 5:21 pm

    GUID vs.Sequential GUID

    A typical pattern it’s to use Guid as PK for tables, but, as referred in other discussions (see Advantages and disadvantages of GUID / UUID database keys) there are some performance issues.

    This is a typical Guid sequence

    f3818d69-2552-40b7-a403-01a6db4552f7
    7ce31615-fafb-42c4-b317-40d21a6a3c60
    94732fc7-768e-4cf2-9107-f0953f6795a5

    Problems of this kind of data are:<
    –

    • Wide distributions of values
    • Almost randomically ones
    • Index usage is very, very, very bad
    • A lot of leaf moving
    • Almost every PK need to be at least on a non clustered index
    • Problem happens both on Oracle and SQL Server

    A possible solution is using Sequential Guid, that are generated as follows:

    cc6466f7-1066-11dd-acb6-005056c00008
    cc6466f8-1066-11dd-acb6-005056c00008
    cc6466f9-1066-11dd-acb6-005056c00008

    How to generate them From C# code:

    [DllImport('rpcrt4.dll', SetLastError = true)] static extern int UuidCreateSequential(out Guid guid);  public static Guid SequentialGuid() {     const int RPC_S_OK = 0;     Guid g;     if (UuidCreateSequential(out g) != RPC_S_OK)         return Guid.NewGuid();     else         return g; } 

    Benefits

    • Better usage of index
    • Allow usage of clustered keys (to be verified in NLB scenarios)
    • Less disk usage
    • 20-25% of performance increase at a minimum cost

    Real life measurement: Scenario:

    • Guid stored as UniqueIdentifier types on SQL Server
    • Guid stored as CHAR(36) on Oracle
    • Lot of insert operations, batched together in a single transaction
    • From 1 to 100s of inserts depending on table
    • Some tables > 10 millions rows

    Laboratory Test – SQL Server

    VS2008 test, 10 concurrent users, no think time, benchmark process with 600 inserts in batch for leaf table
    Standard Guid
    Avg. Process duration: 10.5 sec
    Avg. Request for second: 54.6
    Avg. Resp. Time: 0.26

    Sequential Guid
    Avg. Process duration: 4.6 sec
    Avg. Request for second: 87.1
    Avg. Resp. Time: 0.12

    Results on Oracle (sorry, different tool used for test) 1.327.613 insert on a table with a Guid PK

    Standard Guid, 0.02 sec. elapsed time for each insert, 2.861 sec. of CPU time, total of 31.049 sec. elapsed

    Sequential Guid, 0.00 sec. elapsed time for each insert, 1.142 sec. of CPU time, total of 3.667 sec. elapsed

    The DB file sequential read wait time passed from 6.4 millions wait events for 62.415 seconds to 1.2 million wait events for 11.063 seconds.

    It’s important to see that all the sequential guid can be guessed, so it’s not a good idea to use them if security is a concern, still using standard guid.
    To make it short… if you use Guid as PK use sequential guid every time they are not passed back and forward from a UI, they will speed up operation and do not cost anything to implement.

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

Sidebar

Related Questions

Has someone ever used isReliable with the Google Translate API? It always returns undefined
Has anyone ever used Solrnet inside CLR Stored Procedures? I would really appreciate pointers
Has someone here ever had experience with the D programming language ? It seems
Has someone created a language which can be used to track/analyze dependencies between grid
I have a SQlite database gets populated when ever someone adds a filename and
I'd like to know if someone there in the community has ever implemented 2
Python has a singleton called NotImplemented . Why would someone want to ever return
This question already has an answer here: Is there ever a reason to not
Has someone successfully overridden the scoring of documents in a query so that the
Is this type of control only available in a 3rd-party library? Has someone implemented

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.