From: | Stuart Bishop <stuart(at)stuartbishop(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: UUID column as pimrary key? |
Date: | 2011-01-06 08:52:15 |
Message-ID: | AANLkTim_Zqg+NNKNxcq+qMX4vXM0FrX2DMfAGKFL=D_8@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
>>> Next to that, UUID's are generated by computers. I have no doubts that
>>> the numeric space that makes up a UUID allows for collision chances as
>>> low as described, but are computers capable of generating those
>>> numbers sufficiently random that they actually achieve that low a
>>> chance? I think that's pushing it.
> The main point with the randomness of UUID's remains that you _can_ have a collision at any given moment. It's unlikely to ever happen, but you can't predict when it will happen if it does. The possible consequences of a collision matter a lot in designing whether and how to handle these collisions. Maybe it doesn't matter at all, maybe you should get a really hefty insurance, or maybe you need to evacuate the country.
Given the math, I suspect the chance of a UUID collision generated by
a respected library is roughly the same or less than any other method
of choosing a unique id. If you are looking at these extreme
improbabilities, your SERIAL isn't guaranteed unique either when you
take into account cosmic rays flipping the right bits in your ECC
memory or on your disk platter.
So if you are worried about such things, give up now because your
application is going to have to run with hardware and software in this
universe with all its limitations.
Maybe I should start a business in providing UUID collision insurance?
--
Stuart Bishop <stuart(at)stuartbishop(dot)net>
http://www.stuartbishop.net/
From | Date | Subject | |
---|---|---|---|
Next Message | Jasen Betts | 2011-01-06 09:51:03 | Re: UUID column as pimrary key? |
Previous Message | Alban Hertroys | 2011-01-06 08:02:43 | Re: UUID column as pimrary key? |