Re: UUID column as pimrary key?

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: pgsql-general(at)postgresql(dot)org
Cc: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>, Scott Ribe <scott_ribe(at)elevated-dev(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bill Moran <wmoran(at)potentialtech(dot)com>
Subject: Re: UUID column as pimrary key?
Date: 2011-01-05 17:30:42
Message-ID: 201101051830.42778.rsmogura@softperience.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sorry for not citation...

When I was talking about "almost unique", I was meaning that the UUID is
random so there is no guarantee that you will not generate two indencital
UUIDs even in subsequent calls, but it has looooow probability (you have
greater chances to win in LOTTO).

128bits is huge for now, but what will happen in next 2,3 years? In 20th
century, people think storing only last two digit of year will be enaugh!!!
Suppose we are creating gloabl, distributed database for storing information
about mobile device and base station it logged in.

If we want to guarantee uniquness of UUID across calls, we could talk about
much more far _pseudo_ random generator, then "normal" pseudo - randoms, and
what I think we need to keep state of such random generator, and share and
lock it for multiple concurrent calls. So it will not be something different
then ordinal serial column...

Now I think it's clear there is no "magical" algorithm for UUIDs.

My opinion about all of those UUID with MAC, IP addresses, Microsoft "growing"
UUIDs. All of this decrases chance of uniqness of UUID. If we will keep n
first bits of UUID constant, then we have only 128-n bits random (truly in
UUIDs we have one decimal field reserved for UUID version). If we want next
UUID to be greater then previous, at each call we will remove (next-prev) of
possible values.

Shouldn't this be enaugh for namespace UUIDs
new UUID("namespece".hashCode(), "name".hashChode())

or a little joke...
new UUID(1,1) meats this condition
> o The UUIDs generated at different times from the same name in the
>
> same namespace MUST be equal.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2011-01-05 17:32:41 Fwd: Re: UUID column as pimrary key?
Previous Message Adrian Klaver 2011-01-05 16:57:45 Re: UUID column as pimrary key?