Re: GUID in postgres - Mailing list pgsql-sql

From John Hasler
Subject Re: GUID in postgres
Date
Msg-id 87snc7x5kv.fsf@toncho.dhh.gt.org
Whole thread Raw
In response to Re: GUID in postgres  (Horst Herb <hherb@malleenet.net.au>)
List pgsql-sql
I wrote:
> Globally Unique IDentifier, probably.  Just hash a 128 bit random number
> with the current date.

Horst writes:
> That gives you no gurantee it will be unique.

There is no such guarantee.  The probability of a collision due to errors
and bugs using a "deterministic" system is sure to be at least as large as
the the probability of a chance collision using large random numbers
(_random_, not pseudorandom).  Stick machine, table, and database ID's in
there as well if it makes you more comfortable, but even without them the
risk of a collision is down there with the risk of cosmic ray induced
errors.  _Nothing_, however, can make it zero.

> - All tables in need of a global ID _within_ a database inherit a globid
> table which contains nothing but an ID of type serial.  - When we need
> cross-database unique IDs within the same system, the globid table
> contains a database identifier as well (like the OID of the pg_database
> entry for the database).

And that's fine, but the GUID system uses the word "global" in a much more
grandiose sense.
-- 
John Hasler
john@dhh.gt.org
Dancing Horse Hill
Elmwood, Wisconsin


pgsql-sql by date:

Previous
From: Haller Christoph
Date:
Subject: Re: How to find primary keys by querying system tables
Next
From: Reiner Dassing
Date:
Subject: Re: [HACKERS] Index of a table is not used (in any case)