From: | Bill Moran <wmoran(at)potentialtech(dot)com> |
---|---|
To: | Scott Ribe <scott_ribe(at)elevated-dev(dot)com> |
Cc: | Radosław Smogura <rsmogura(at)softperience(dot)eu>, PostgreSQL general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: UUID column as pimrary key? |
Date: | 2011-01-05 15:05:29 |
Message-ID: | 20110105100529.6407650b.wmoran@potentialtech.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In response to Scott Ribe <scott_ribe(at)elevated-dev(dot)com>:
> On Jan 5, 2011, at 1:31 AM, Radosław Smogura wrote:
>
> > * simple to generate, and 128bit random is almost globally unique,
>
> Almost? Should be totally unique, as long as your random source is decent quality.
This is going off-topic, but I did some research on this because we
were considering using UUIDs for various keys ...
Fact is, UUIDs are not _guaranteed_ to be unique. If you use the generating
system that includes a MAC address, then in theory, they are guaranteed
to be unique, but in practice, MAC addresses aren't guaranteed to be
unique either, so that's not 100% either.
Beyond that, the namespace size for a UUID is so incomprehensibly huge
that the chance of two randomly generated UUIDs having the same value
is incomprehensibly unlikely ... it is, however, not a 100% guarantee.
Anyway, in our case, we determined that the chance of UUID collision
for the dataset in question was extremely unlikely, however, the
consequences of such a collision were pretty bad. We also determined
that we were able to control a "unit ID" for each independent system
that would generate IDs, which could (a) be part of a unique seed for
UUIDs, or (b) be a prefix to a autonumber ID that would be a lot easier
to read and work with manually. In the end, we chose b for the human
factor.
Face it, reading, remembering, and typing UUIDs kinda sucks.
--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Ribe | 2011-01-05 15:06:16 | Re: UUID column as pimrary key? |
Previous Message | Scott Ribe | 2011-01-05 15:04:45 | Re: UUID column as pimrary key? |