Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id A088F632CD5 for ; Mon, 23 Aug 2010 12:22:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 56767-10 for ; Mon, 23 Aug 2010 15:22:47 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp02.lnh.mail.rcn.net (smtp02.lnh.mail.rcn.net [207.172.157.102]) by mail.postgresql.org (Postfix) with ESMTP id 54CE863287F for ; Mon, 23 Aug 2010 12:22:47 -0300 (ADT) Received: from ms14.lnh.mail.rcn.net ([208.58.56.82]) by smtp02.lnh.mail.rcn.net with ESMTP; 23 Aug 2010 11:22:46 -0400 Received: (from ms14.lnh.mail.rcn.net [69.182.178.117]) by ms14.lnh.mail.rcn.net (MOS 4.1.9-GA) with HTTP/1.1 id AID25735 (AUTH gnuoytr@rcn.com); Mon, 23 Aug 2010 11:22:46 -0400 (EDT) From: Subject: Re: Inefficient query plan To: pgsql-performance@postgresql.org X-Mailer: Mirapoint Webmail Direct 4.1.9-GA MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20100823112246.AID25735@ms14.lnh.mail.rcn.net> Date: Mon, 23 Aug 2010 11:22:46 -0400 (EDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-10 required=5 tests=BAYES_50=0.8, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201008/265 X-Sequence-Number: 40108 >I may be a little bit over-sensitive on the topic, because I've seen >so many people who consider it "wrong" to use natural keys on any >table *ever*. About one out of every four or five programmers who >gets hired here feels compelled to argue that we should add >surrogate keys to all our tables for no reason beyond "it's the >thing to do". I've been at this for 38 years, most of that as a >consultant to a wide variety of businesses, government agencies, and >NPOs; and in my experience it usually is *not* the right thing to >do. > >Don't worry -- when I see evidence that surrogate keys will solve a >problem which has not yielded to more conservative solutions, I'll >suggest using them. > >-Kevin > Ah feeel your pain, brother. Been there, done that. In almost every case, those who make the "thou shalt always, and only, use a surrogate key" cite folks like Ambler as authoritative rather than folks like Date. The Kiddie Koder Krew are woefully uninformed about the history and development of RDBMS, and why some approaches are more intelligent than others. Ambler, et al coders all, have poisoned more minds than can be counted. Dijkstra called out BASIC and COBOL for polluting the minds of young coders. Allowing Ambler and the like to be "thought leaders" in RDBMS is just as polluting. There, I said. -- Robert