Search Postgresql Archives

Re: UUID column as pimrary key?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 6 January 2011 00:32, dennis jenkins <dennis.jenkins.75@xxxxxxxxx> wrote:
On Wed, Jan 5, 2011 at 1:03 PM, Bill Moran <wmoran@xxxxxxxxxxxxxxxxx> wrote:
>
> But the point (that you are trying to sidestep) is that the UUID namespace
> is finite, so therefore you WILL hit a problem with conflicts at some point.
> Just because that point is larger than most people have to concern themselves
> with isn't an invalidation.

The UUID itself is 128 bits. ÂSome of those bits are pre-determined.
I don't recall, but I think that a "normal" UUID has 121 bits of
randomness.

How many would one have to store in a database before a collision
would even be a concern. ÂSuch a database would be freaking huge.
Probably far larger than anything that anyone has.

NotÂnecessarily.

Bad luck: two inserts, and one collision.
Good luck: many many inserts, without any collision.

If you have ten pairs of socks... how many do you need to choose, to have two from the same pair (to have a collision)?
Good luck: 2
Bad luck: 11

With uuid you can write a program that most of the time works correctly, but sometimes not.
If you need a program that works correctly all the time, you can use UUID, with the overhead of a procedure, that checks the collisions, and does something with that, or you could generate the PK without UUID, and be sure that the generator won't have collisions, just because it is a normal sequence.

regards
Szymon


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux