Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id E01029FB545 for ; Wed, 18 Apr 2007 15:10:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 39846-05-2 for ; Wed, 18 Apr 2007 15:10:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from globalrelay.com (mail1.globalrelay.com [204.92.49.200]) by postgresql.org (Postfix) with ESMTP id 43CC79FB795 for ; Wed, 18 Apr 2007 15:10:01 -0300 (ADT) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES X-Real-To: pgsql-performance@postgresql.org Received: from [63.226.156.118] (HELO DaveEMachine) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 136547591 for pgsql-performance@postgresql.org; Wed, 18 Apr 2007 11:09:59 -0700 From: "Dave Dutcher" To: Subject: Re: Basic Q on superfluous primary keys Date: Wed, 18 Apr 2007 13:09:57 -0500 Message-ID: <01db01c781e4$c700bf30$2e00a8c0@tridecap.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6822 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Thread-Index: AceBDEweE4kpz5UgRRyCIk7RldkPNQA1HBbg In-Reply-To: Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.58 tagged_above=0 required=5 tests=AWL=-0.420, BAYES_60=1 X-Spam-Level: X-Archive-Number: 200704/337 X-Sequence-Number: 24214 I think a database with all natural keys is unrealistic. For example if = you have a table that refers to people, are you going to use their name as a primary key? Names change all the time due to things like marriage, divorce, or trouble with the law. We have tables with 20 million rows = which reference back to a table of people, and if I used the person's name as = key, it would be a major pain when somebody's name changes. Even if there is referential integrity, one person might be referred to by 25% of the 20 million rows, so the update would take quite a long time. Also the = table will be filled with dead rows and the indexes will likely be bloated. = If I want to clean that up, it will take a vacuum full or a cluster which = will lock the whole table and run for hours. If I use a surrogate key, I can change their name in one row and be done with it. =20 Just my 2 cents. Dave