Re: Effects of cascading references in foreign keys

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, Bruno Wolff III <bruno(at)wolff(dot)to>, Martin Lesser <ml-pgsql(at)bettercom(dot)de>, Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Effects of cascading references in foreign keys
Date: 2007-09-26 08:21:12
Message-ID: 200709260821.l8Q8LCX05347@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


This has been saved for the 8.4 release:

http://momjian.postgresql.org/cgi-bin/pgpatches_hold

---------------------------------------------------------------------------

Tom Lane wrote:
> Michael Fuhr <mike(at)fuhr(dot)org> writes:
> > On Sat, Oct 29, 2005 at 09:49:47AM -0500, Bruno Wolff III wrote:
> >> It looks like this feature was added last May, so I think it only applies
> >> to 8.1.
>
> > Earlier versions appear to have at least some kind of optimization.
>
> Yeah. IIRC, for quite some time we've had tests inside the FK update
> triggers to not bother to search the other table if the key value hasn't
> changed. What we did in 8.1 was to push that test further upstream, so
> that the trigger event isn't even queued if the key value hasn't
> changed. (This is why you don't see the trigger shown as being called
> even once.)
>
> 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?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message pgdba 2007-09-26 14:22:45 Incorrect row estimates in plan?
Previous Message Tom Lane 2007-09-26 04:02:58 Re: REPOST: Nested loops row estimates always too high