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 619CA11F6C2F for ; Tue, 11 Apr 2006 17:26:12 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.118 X-Spam-Level: X-Spam-Status: No, score=0.118 required=5 tests=[AWL=0.117, UNPARSEABLE_RELAY=0.001] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 1mPcq8+DLWoE for ; Tue, 11 Apr 2006 17:25:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 69D2B11F6C78 for ; Tue, 11 Apr 2006 16:48:47 -0300 (ADT) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Tue, 11 Apr 2006 19:48:46 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 11 Apr 2006 14:48:46 -0500 Subject: Re: FOREIGN KEYS vs PERFORMANCE From: Scott Marlowe To: Rodrigo Sakai Cc: pgsql-performance@postgresql.org In-Reply-To: <001301c65d9c$08884ef0$4700a8c0@TREEZANTHUS> References: <001301c65d9c$08884ef0$4700a8c0@TREEZANTHUS> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1144784926.32269.88.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 11 Apr 2006 14:48:46 -0500 X-Archive-Number: 200604/241 X-Sequence-Number: 18325 On Tue, 2006-04-11 at 14:13, Rodrigo Sakai wrote: > Hi, > > 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????? > Specifically, the system we are developing is a server/cliente > architecture that the server is the database and the fat client is an > application developed in DELPHI!!! > If ref integrity is important, you'll have to do it either in the app or the database. Almost always, it's faster to let the database do it, as there's less traffic across the wire required to maintain ref integrity, plus, the guys who wrote the database have spent years making sure race conditions won't scram your data. For simple, straight forward FK->PK relationships, you will likely NOT be able to beat the database in terms of either reliability or performance with your own code.