Datatype: uniqueidentifier or bigint as primarykey?

Uniqueidentifier or bigint as primarykey? Which is better to use as a primary key?

Using uniqueidentifier you will be given a global uniqueidentifier
but this also means the value will be very large! larger than bigint!
16 bytes vs 4 bytes!!!

is it really important?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SujithData ArchitectCommented:
I dont think it makes any considerable difference, as long as you dont have a composite primary key.
From my point of view, it makes difference for  large tables.
Redundant 12 bytes could be at cost, because as PK it will involved in all seek operations.

Another reason: you cannot make guid autoincrement (by IDENTITY(1,1)).

The only huge benefit of guid is really multy-server environment, to provide uniqueness.

Depends what you are going to use it for. You haven't given us much clue because "primary key" actually says very little about how it will be used. Do you mean that you intend to use it only as a surrogate key?
KhouAuthor Commented:
" Do you mean that you intend to use it only as a surrogate key?"


At the end of the day, I decided to Unquieidentifier , with newsequecialid().

Reason: GUID for replication, newsequeicailid() for performance.
still not as fast as int, but will do.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.