Re: Alternative to serial primary key - Mailing list pgsql-sql

From Markus Schaber
Subject Re: Alternative to serial primary key
Date
Msg-id 44ACEA1C.9030804@logix-tt.com
Whole thread Raw
In response to Alternative to serial primary key  ("David Clarke" <pigwin32@gmail.com>)
Responses Re: Alternative to serial primary key  ("David Clarke" <pigwin32@gmail.com>)
List pgsql-sql
Hi, David,

David Clarke wrote:
> It occurred to me that if I used a hash function on insert to
> generate another column and used that column as the primary key then I
> have a value that meets a lot of the requirements for a good key,
> including that I can regenerate the exact value from my data,
> something that is impossible with a serial id.

This is a good idea if you want to have taller indices, but you still
need to re-check the "real" key due to hash collisions.

It's some kind of lossy index, pretty the same as the GIST index type
PostGIS uses.

If you've plenty of time to spend, you could also bring the hash index
type back to life, which is currently deprecated according to the
PostgreSQL docs...

HTH,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org


pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Alternative to serial primary key
Next
From: "David Clarke"
Date:
Subject: Re: Alternative to serial primary key