X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 79D669FA147 for ; Thu, 6 Jul 2006 08:10:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 06743-01 for ; Thu, 6 Jul 2006 08:10:42 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id B9F759FA0EC for ; Thu, 6 Jul 2006 08:10:42 -0300 (ADT) Received: from kingfisher.intern.logix-tt.com (Tba4d.t.pppool.de [89.55.186.77]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 7BA39656BB; Thu, 6 Jul 2006 13:12:22 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 2FE2E184C7A8D; Thu, 6 Jul 2006 13:10:56 +0200 (CEST) Message-ID: <44ACEFBF.7030903@logix-tt.com> Date: Thu, 06 Jul 2006 13:10:55 +0200 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Thunderbird 1.5.0.2 (X11/20060516) MIME-Version: 1.0 To: David Clarke Cc: pgsql-sql@postgresql.org Subject: Re: Alternative to serial primary key References: <12b7ac1e0607060316ub7b5e21i5e8e3bef2504e02c@mail.gmail.com> <44ACEA1C.9030804@logix-tt.com> <12b7ac1e0607060406r16d03f74mfa303eec9ab4821f@mail.gmail.com> In-Reply-To: <12b7ac1e0607060406r16d03f74mfa303eec9ab4821f@mail.gmail.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/57 X-Sequence-Number: 25631 Hi, David, David Clarke wrote: > On 7/6/06, Markus Schaber 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