Re: [COMMITTERS] pgsql: Add a WHEN clause to CREATE TRIGGER, allowing a boolean

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Add a WHEN clause to CREATE TRIGGER, allowing a boolean
Date: 2009-11-20 22:12:32
Message-ID: 603c8f070911201412k2f023565lb8735065baf35a3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Fri, Nov 20, 2009 at 5:05 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> Random thought: would it be possible to use something like this to
>> optimize foreign key constraints, by not firing them if none of the
>> relevant columns have been updated?
>
> There already is code in there to do that; see RI_FKey_keyequal_upd_fk
> and RI_FKey_keyequal_upd_pk.

*scratches head* Hmm, I see EXPLAIN showing time & calls logged
against fk triggers even when I don't update any columns, unless the
existing value is NULL. But maybe I'm doing something strange, or
misinterpreting the output.

> Earlier in the discussion of this patch I had suggested eliminating the
> special-case code for FKs in favor of using a WHEN clause, but that
> would probably not fly unless we can make the WHEN-based implementation
> just as fast as the bespoke code; which seems unlikely.

Yeah.

...Robert

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message User Achernow 2009-11-21 01:16:00 libpqtypes - libpqtypes: Update ChnageLog
Previous Message Tom Lane 2009-11-20 22:05:02 Re: [COMMITTERS] pgsql: Add a WHEN clause to CREATE TRIGGER, allowing a boolean

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Urbański 2009-11-20 23:22:33 Re: Partitioning option for COPY
Previous Message Tom Lane 2009-11-20 22:05:02 Re: [COMMITTERS] pgsql: Add a WHEN clause to CREATE TRIGGER, allowing a boolean