X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 84419DB345 for ; Sat, 29 Oct 2005 15:35:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38970-04 for ; Sat, 29 Oct 2005 18:35:36 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 43BD5DB340 for ; Sat, 29 Oct 2005 15:35:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j9TIZPCd012098; Sat, 29 Oct 2005 14:35:25 -0400 (EDT) To: Michael Fuhr Cc: Bruno Wolff III , Martin Lesser , Stephan Szabo , pgsql-performance@postgresql.org Subject: Re: Effects of cascading references in foreign keys In-reply-to: <11904.1130608918@sss.pgh.pa.us> References: <87acgszihk.fsf@nb-aspire.bettercom.de> <20051029142432.GA79557@winnie.fuhr.org> <20051029144947.GB21068@wolff.to> <20051029160527.GA80135@winnie.fuhr.org> <11904.1130608918@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 29 Oct 2005 14:01:58 -0400" Date: Sat, 29 Oct 2005 14:35:25 -0400 Message-ID: <12097.1130610925@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200510/458 X-Sequence-Number: 15226 I wrote: > Looking at this, I wonder if there isn't a bug or at least an > inefficiency in 8.1. The KeysEqual short circuit tests are still there > in ri_triggers.c; aren't they now redundant with the test in triggers.c? > And don't they need to account for the special case mentioned in the > comment in triggers.c, that the RI check must still be done if we are > looking at a row updated by the same transaction that created it? OK, I take back the possible-bug comment: the special case only applies to the FK-side triggers, which is to say RI_FKey_check, and that routine doesn't attempt to skip the check on equal old/new keys. I'm still wondering though if the KeysEqual tests in the other RI triggers aren't now a waste of cycles. regards, tom lane