Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id A772F6328D8 for ; Wed, 10 Feb 2010 13:36:40 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 66006-07 for ; Wed, 10 Feb 2010 17:36:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.anarazel.de (mail.anarazel.de [217.115.131.40]) by mail.postgresql.org (Postfix) with ESMTP id 346A9631870 for ; Wed, 10 Feb 2010 13:36:30 -0400 (AST) Received: from alap2.localnet (e178214023.adsl.alicedsl.de [85.178.214.23]) by mail.anarazel.de (Postfix) with ESMTPSA id 90861448009; Wed, 10 Feb 2010 18:36:27 +0100 (CET) From: Andres Freund To: pgsql-performance@postgresql.org Subject: Re: Deferred constraint and delete performance Date: Wed, 10 Feb 2010 18:36:23 +0100 User-Agent: KMail/1.13.0 (Linux/2.6.33-rc5-andres-00243-g6ea299e; KDE/4.3.98; x86_64; ; ) Cc: Tom Lane , Franck Routier References: <1265799331.28404.14.camel@franck-laptop> <16009.1265813800@sss.pgh.pa.us> In-Reply-To: <16009.1265813800@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201002101836.25964.andres@anarazel.de> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.11 tagged_above=-10 required=5 tests=BAYES_05=-1.11 X-Spam-Level: X-Archive-Number: 201002/162 X-Sequence-Number: 37583 On Wednesday 10 February 2010 15:56:40 Tom Lane wrote: > Franck Routier writes: > > I am wondering if deferring foreign key constraints (instead of > > disableing them) would increase performance, compared to non deferred > > constraints > > No, it wouldn't make any noticeable difference AFAICS. It would > postpone the work from end-of-statement to end-of-transaction, > but not make the work happen any more (or less) efficiently. It could make a difference if the transaction is rather long and updates the same row repeatedly because of better cache usage. But I admit thats a bit of a constructed scenario (where one likely would get into trigger-queue size problems as well) Andres