Re: uuid type for postgres

From: nathan wagner <nw(at)hydaspes(dot)if(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: uuid type for postgres
Date: 2005-09-07 02:36:06
Message-ID: 20050907023606.GA2181@granicus.if.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

On Tue, Sep 06, 2005 at 06:40:27PM -0700, josh(at)agliodbs(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew - Supernews 2005-09-07 02:48:00 Re: inet increment with int
Previous Message Dann Corbit 2005-09-07 01:47:06 Re: uuid type for postgres

Browse pgsql-sql by date

  From Date Subject
Next Message Joÿffffffffffe3o Carvalho 2005-09-07 02:43:44 Statistics from Sequences
Previous Message Josh Berkus 2005-09-07 01:40:27 Re: uuid type for postgres