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

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

David Clarke wrote:
> On 7/6/06, Markus Schaber <schabi@logix-tt.com> wrote:
>> 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.
> 
> I am aware there are collisions with md5 but without any actual proof
> I believe the risk to be very low with the data I'm storing which is a
> kind of scrubbed free form residential address.

Then you'll have to use the re-check approach, like:

SELECT * FROM foo WHERE hashed_key = hash(mykey) && plain_key = mykey;

And then have an non-unique index on hashed_key, and probably no index n
my_key (to give the planner a hint which index to use).

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: "David Clarke"
Date:
Subject: Re: Alternative to serial primary key
Next
From: Andrew Sullivan
Date:
Subject: Re: Alternative to serial primary key