Re: UUID column as pimrary key?

From: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
To: Bill Moran <wmoran(at)potentialtech(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 16:18:37
Message-ID: A6A6ABF5-71F7-4941-9D0B-D1CEE5C8ED0D@elevated-dev.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jan 5, 2011, at 8:55 AM, Bill Moran wrote:

> That statement demonstrates a lack of investigation and/or consideration
> of the circumstances.

No, it doesn't.

> However, if there are 5000 devices generating 100 UUIDs per hour, and you'll
> be keeping those records for 10+ years, the chances of collisions near
> the end of that 10 year span get high enough to actually make developers
> nervous.

No, they don't. At the end of your hypothetical 10-year period, you will have used about 43,000,000,000 UUIDs, or about 1/100,000,000,000,000,000,000,000,000th of the UUID space (assuming random UUIDs). Leaving you with a chance of a single collision of about 1/18,000,000,000,000,000.

Assuming of course good entropy. If the generation of random numbers is bad, then UUIDs are not so useful ;-)

--
Scott Ribe
scott_ribe(at)elevated-dev(dot)com
http://www.elevated-dev.com/
(303) 722-0567 voice

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Leif Biberg Kristensen 2011-01-05 16:19:22 Re: UUID column as pimrary key?
Previous Message Andreas Kretschmer 2011-01-05 16:14:26 Re: Archive command and used size of wal