UUID Vs Primary Key
Yesterday i was working on some project and my boss asked me to implement UUID in database instead of primary key
I was not aware of uuid so i searched on google about uuid and i found an intersting quote from wikipedia
".. after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%."
I read since it is based on timestamp ,hence it is almost impossible to generate duplicate uuid, then i thought if it really so , then why i don't know about uuid till now? I don't even read about it in my engineering books . Why we don't use it as it can reduce many concurrency problems in database ?
If anyone knows about it then please share
I was not aware of uuid so i searched on google about uuid and i found an intersting quote from wikipedia
".. after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%."
I read since it is based on timestamp ,hence it is almost impossible to generate duplicate uuid, then i thought if it really so , then why i don't know about uuid till now? I don't even read about it in my engineering books . Why we don't use it as it can reduce many concurrency problems in database ?
If anyone knows about it then please share
Replies
-
PraveenKumar PurushothamanVersion 5 UUIDs use a scheme with SHA-1 hashing - This is something like gives a promise that it won't be duplicated right?
-
gaurav.bhorkarGuid's are 128 bit long, may be that is the reason we don't use them as primary keys for unnecessary space occupied. An auto incremented counter mostly solves our problem of a primary key in most of the databases.
-
PraveenKumar PurushothamanFor space constraints you gotta use PK only... ๐
-
Manish Goyal
May be it occupies large space ,but it also solves concurrency problemgaurav.bhorkarGuid's are 128 bit long, may be that is the reason we don't use them as primary keys for unnecessary space occupied. An auto incremented counter mostly solves our problem of a primary key in most of the databases. -
PraveenKumar PurushothamanWhat if there are two same UUID... The probability is less, but it is possible!!! ๐ฒ
-
Manish Goyal
UPTO i have read about it on net ,praveenscienceWhat if there are two same UUID... The probability is less, but it is possible!!! ๐ฒ
It is based on timestamp value , so there are very less chance that there will be same uuid , at least for next 25 years -
PraveenKumar PurushothamanI meant the theoretical stuff dude... Yeah, 25 years is there... ๐
You are reading an archived discussion.
Related Posts
i m searching for best engineering college in UP๐
i m in BE computer science and i need a project with sponsorship plz help and suggest some ideas
Dear friends
Now, i have done my B.E mechanical graduation.I like to become a scientist.
Now i have two choice, one is go to job(don't selected in any companies..prepared for...
Hello Everybody,
This is Mike Paul and I am just come to this community forum. I am really feeling good to be out here since I would like to say...
Dear friends
What's the difference between venturi meter and Nozzle? Both are have convergent,Divergent and throat portions.Shall we use venturi meter as a Nozzle?Kindly clarify.๐