Re: UUID column as pimrary key?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
Cc: Bill Moran <wmoran(at)potentialtech(dot)com>, 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 16:01:52
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Scott Ribe <scott_ribe(at)elevated-dev(dot)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 simultaneously struck by lightning and killed in their sleep, and it is *far* more likely that all life on earth will be wiped out 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

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

regards, tom lane

In response to


Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2011-01-05 16:03:47 Re: UUID column as pimrary key?
Previous Message Bill Moran 2011-01-05 15:55:22 Re: UUID column as pimrary key?