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

Replies

  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Version 5 UUIDs use a scheme with SHA-1 hashing - This is something like gives a promise that it won't be duplicated right?
  • gaurav.bhorkar
    gaurav.bhorkar
    Guid'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 Purushothaman
    PraveenKumar Purushothaman
    For space constraints you gotta use PK only... ๐Ÿ˜”
  • Manish Goyal
    Manish Goyal
    gaurav.bhorkar
    Guid'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.
    May be it occupies large space ,but it also solves concurrency problem
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    What if there are two same UUID... The probability is less, but it is possible!!! ๐Ÿ˜ฒ
  • Manish Goyal
    Manish Goyal
    praveenscience
    What if there are two same UUID... The probability is less, but it is possible!!! ๐Ÿ˜ฒ
    UPTO i have read about it on net ,
    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 Purushothaman
    PraveenKumar Purushothaman
    I 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.๐Ÿ˜•