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 9963F9FA0EC for ; Thu, 6 Jul 2006 07:46:50 -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 26126-07 for ; Thu, 6 Jul 2006 07:46:44 -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 51AA39F94F3 for ; Thu, 6 Jul 2006 07:46:44 -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 E3E02656BB; Thu, 6 Jul 2006 12:48:18 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 218FB184C7A8D; Thu, 6 Jul 2006 12:46:53 +0200 (CEST) Message-ID: <44ACEA1C.9030804@logix-tt.com> Date: Thu, 06 Jul 2006 12:46:52 +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> In-Reply-To: <12b7ac1e0607060316ub7b5e21i5e8e3bef2504e02c@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/55 X-Sequence-Number: 25629 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