Re: Effects of cascading references in foreign keys

Bruno Wolff III <bruno@wolff.to>

From: Bruno Wolff III <bruno@wolff.to>
To: Michael Fuhr <mike@fuhr.org>
Cc: Martin Lesser <ml-pgsql@bettercom.de>, pgsql-performance@postgresql.org
Date: 2005-10-29T14:49:47Z
Lists: pgsql-performance
On Sat, Oct 29, 2005 at 08:24:32 -0600,
  Michael Fuhr <mike@fuhr.org> wrote:
> > Does an UPDATE of e.g. m_fld1 in t_master cause a 'lookup' in all tables
> > which have a cascading update-rule or is this 'lookup' only triggered if
> > the referenced column in t_master is explicitly updated?
> 
> My tests suggest that a lookup on the referring key is done only
> if the referenced key is changed.  Here's an example from 8.1beta4;
> I used this version because EXPLAIN ANALYZE shows triggers and the
> time spent in them, but I see similar performance characteristics
> in earlier versions.  I've intentionally not put an index on the
> referring column to make lookups on it slow.

It looks like this feature was added last May, so I think it only applies
to 8.1.