Re: Alternative to serial primary key

From: Markus Schaber <schabi(at)logix-tt(dot)com>
To: David Clarke <pigwin32(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Alternative to serial primary key
Date: 2006-07-06 11:10:55
Message-ID: 44ACEFBF.7030903@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi, David,

David Clarke wrote:
> On 7/6/06, Markus Schaber <schabi(at)logix-tt(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2006-07-06 11:12:23 Re: Alternative to serial primary key
Previous Message David Clarke 2006-07-06 11:06:09 Re: Alternative to serial primary key