CrazyEngineers
  • Manish
    Manish

    MemberJul 21, 2011

    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
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • PraveenKumar Purushothaman

    MemberJul 23, 2011

    Version 5 UUIDs use a scheme with SHA-1 hashing - This is something like gives a promise that it won't be duplicated right?
    Are you sure? This action cannot be undone.
    Cancel
  • gaurav.bhorkar

    MemberJul 24, 2011

    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.
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 24, 2011

    For space constraints you gotta use PK only... 😔
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberJul 25, 2011

    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
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 25, 2011

    What if there are two same UUID... The probability is less, but it is possible!!! 😲
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberJul 25, 2011

    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
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 25, 2011

    I meant the theoretical stuff dude... Yeah, 25 years is there... 😀
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register