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 DDC8EDACCE for ; Sun, 30 Oct 2005 10:10:49 -0400 (AST) 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 96033-07 for ; Sun, 30 Oct 2005 14:10:46 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id 1CD6CDACAF for ; Sun, 30 Oct 2005 10:10:47 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j9UEAnj02881; Sun, 30 Oct 2005 09:10:49 -0500 (EST) From: Bruce Momjian Message-Id: <200510301410.j9UEAnj02881@candle.pha.pa.us> Subject: Re: Effects of cascading references in foreign keys In-Reply-To: To: "Thomas F. O'Connell" Date: Sun, 30 Oct 2005 09:10:49 -0500 (EST) Cc: PgSQL Performance X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.014 required=5 tests=[AWL=0.014] X-Spam-Score: 0.014 X-Spam-Level: X-Archive-Number: 200510/460 X-Sequence-Number: 15228 Thomas F. O'Connell wrote: > > In 8.1 there is a check to see if the foreign key value has changed > > and if > > not a trigger isn't queued. In the currently released versions any > > update > > will fire triggers. > > The check in comment for trigger.c didn't say if this optimization > > applied > > to both referencing and referenced keys or just one of those. > > If you need to know more you can look at the code at: > > http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/ > > for trigger.c. > > It seems like this warrants an item somewhere in the release notes, > and I'm not currently seeing it (or a related item) anywhere. Perhaps > E.1.3.1 (Performance Improvements)? For some of the more extreme > UPDATE scenarios I've seen, this could be a big win. Hard to say, perhaps: Prevent referential integrity triggers from firing if referenced columns are not changed by an UPDATE Previously, triggers would fire but do nothing. However, the description seems more complex than it is worth. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073