Re: uuid type for postgres - Mailing list pgsql-hackers

From nathan wagner
Subject Re: uuid type for postgres
Date
Msg-id 20050907023606.GA2181@granicus.if.org
Whole thread Raw
In response to Re: uuid type for postgres  (Josh Berkus <josh@agliodbs.com>)
Responses Re: uuid type for postgres
List pgsql-hackers
On Tue, Sep 06, 2005 at 06:40:27PM -0700, josh@agliodbs.com wrote:
> Sure.  What's a UUID, after all?   It's three pieces of information:
> 1) A server or database instance identifier
> 2) A table identifier
> 3) A row identifier
> 
> e.g.:
> chayote.sf.agliodbs.com | public.customers | 4271
> 
> Generally, it's pretty easy to just grab these 3 pieces of information 
> separately and pass them with the data when you want to transmit between 
> servers.  If there are space/overhead considerations, you can put them 
> into a reversable hash.

Take a look at the version 3 or version 5 UUIDs.  They essentially do this.
The hash isn't reversable, but rather recreatable.  Seems that if it
were reversable, it would be compression, not a hash.  Anyway.

You're assuming though that you want to leak this information.  If you do,
or you don't care, go ahead with the v3 or v5 uuid creator.

Or use v1 if you want mac/time based uuids, or v4 for random uuids.

The convenient thing about using the uuid library is that all of these
mechanisms result in the same type, and are thus compatible.

> I've never understood the complex measures which 
> application developers take to create "universal" IDs.

Different applications have different goals.  Unguessability might
be important in some contexts.

-- 
Nathan Wagner


pgsql-hackers by date:

Previous
From: "Dann Corbit"
Date:
Subject: Re: uuid type for postgres
Next
From: Andrew - Supernews
Date:
Subject: Re: inet increment with int