X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A2BC411F61DE for ; Tue, 11 Apr 2006 20:06:29 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 1.166 X-Spam-Level: * X-Spam-Status: No, score=1.166 required=5 tests=[AWL=-0.166, RCVD_IN_BL_SPAMCOP_NET=1.332] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id f4GScmnu2Rdc for ; Tue, 11 Apr 2006 20:06:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [151.155.5.143]) by postgresql.org (Postfix) with ESMTP id 208B311F653D for ; Tue, 11 Apr 2006 20:06:20 -0300 (ADT) Received: from [172.16.1.180] grzm [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.6 $ on Linux; Tue, 11 Apr 2006 17:06:19 -0600 In-Reply-To: <001301c65d9c$08884ef0$4700a8c0@TREEZANTHUS> References: <001301c65d9c$08884ef0$4700a8c0@TREEZANTHUS> Mime-Version: 1.0 (Apple Message framework v749.3) X-Priority: 3 Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <72C39159-1A4B-4595-A978-1DF57AD42527@myrealbox.com> Cc: Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: FOREIGN KEYS vs PERFORMANCE Date: Wed, 12 Apr 2006 08:06:17 +0900 To: "Rodrigo Sakai" X-Mailer: Apple Mail (2.749.3) X-Archive-Number: 200604/253 X-Sequence-Number: 18337 On Apr 12, 2006, at 4:13 , Rodrigo Sakai wrote: > I think this is an old question, but I want to know if it really > is well worth to not create some foreign keys an deal with the > referential integrity at application-level????? If I had to choose between one or the other, I'd leave all referential integrity in the database and deal with the errors thrown when referential integrity is violated in the application. PostgreSQL is designed to handle these kinds of issues. Anything you code in your application is more likely to contain bugs or miss corner cases that would allow referential integrity to be violated. PostgreSQL has been pounded on for years by a great many users and developers, making the likelihood of bugs still remaining much smaller. Of course, you can add some referential integrity checks in your application code, but those should be in addition to your database- level checks. Michael Glaesemann grzm myrealbox com