Re: UUID column as pimrary key? - Mailing list pgsql-general

From Tom Lane
Subject Re: UUID column as pimrary key?
Date
Msg-id 1466.1294243312@sss.pgh.pa.us
Whole thread Raw
In response to Re: UUID column as pimrary key?  (Scott Ribe <scott_ribe@elevated-dev.com>)
Responses Re: UUID column as pimrary key?  (Scott Ribe <scott_ribe@elevated-dev.com>)
List pgsql-general
Scott Ribe <scott_ribe@elevated-dev.com> writes:
> On Jan 5, 2011, at 8:05 AM, Bill Moran wrote:
>> 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

> Yes, as in: it is *far* more likely that all of your team members and all of your client contacts will be
simultaneouslystruck by lightning and killed in their sleep, and it is *far* more likely that all life on earth will be
wipedout by an asteroid impact, 

I see those sorts of arguments all the time, and I consider them pure BS.
Yes, the namespace is theoretically large.  However, the questions you
really have to answer are (a) how much of the namespace is actually
being used by the UUID generation methods in use in a particular
application; (b) how sure can you be that there is not correlation
between UUIDs generated in different places/sessions.

In practical use I think the odds of a collision are *far* higher than
you are suggesting, unless the UUID generation is being done with a lot
more care than is likely if the user takes these sorts of claims at face
value.  The odds may still be low enough to be a very good risk, but
you need to think about it not just bet your database on it without
thinking.

Being paranoid is a good thing.  It's what DBAs are paid for.

            regards, tom lane

pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: UUID column as pimrary key?
Next
From: Rob Sargent
Date:
Subject: Re: UUID column as pimrary key?