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 32C2E9FACFE for ; Fri, 7 Jul 2006 02:25:20 -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 58246-06 for ; Fri, 7 Jul 2006 02:25:12 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web33302.mail.mud.yahoo.com (web33302.mail.mud.yahoo.com [68.142.206.117]) by postgresql.org (Postfix) with SMTP id 324949FB1B7 for ; Fri, 7 Jul 2006 02:25:12 -0300 (ADT) Received: (qmail 87861 invoked by uid 60001); 7 Jul 2006 05:25:11 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=xEy7ZSsfoyWLWYXtnOEr/ZFpDoGBGwVQD/SW1l8X55aH3z52oymrvz/TeC7epylA+lUu+iDxlbW69vJZtJ3WeKcEPuGdZ5hqNpx6z0DNWZyFYxKxJI5UteXH6PNR/Szgkj90Pw74ud5DqIic+TCDAS1Cb4Z3StGntYXGb1uSvts= ; Message-ID: <20060707052511.87859.qmail@web33302.mail.mud.yahoo.com> Received: from [66.75.13.239] by web33302.mail.mud.yahoo.com via HTTP; Thu, 06 Jul 2006 22:25:11 PDT Date: Thu, 6 Jul 2006 22:25:11 -0700 (PDT) From: Subject: Re: Alternative to serial primary key To: David Clarke Cc: Aaron Bono , pgsql-sql@postgresql.org In-Reply-To: <12b7ac1e0607061330o34adbd6ds9bd624d3889c7fe7@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/76 X-Sequence-Number: 25650 > Plus I feel I would be remiss in not > exploring an > alternative to the serial key. why? it is a tried and true method. > I can always > regenerate my primary key > from the data which is impossible with a serial key. why on earth would you need to "regenerate" the primary key? it is used to link related data in different tables, not as some sort of meaningful piece of data all by itself. even if you wanted to "regenerate" the primary key, using a serial is still easier. under the hash scheme, you have know the *exact* address... including abbreviation, periods, etc... if you use a serial, you could query the table using SQL's LIKE clause and get all the serial results that match the string you entered. if you enter the *exact* address, you'll get a single result - unless that address is entered twice. you can avoid that possibility by making address a unique column. when you link tables together, you can visually one big table with all the linked data... and that's what you can get when you join the tables. if you know one column's information (or part of it using LIKE), you can return any desired result in the same row (LIKE might return more than one result). > I believe the > risk of collision using md5 is effectively zero on > this data and I can > put a unique index over it. why risk it? what if you are wrong? > I'm kind of new to sql so apologies if this is a > naive approach. > Thanks to all for responses. no worries. i'm learning a ton as time goes on, myself. i do think you are over thinking this issue a bit, though. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com