Re: Rule vs Trigger

From: "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at>
To: "Tom Lane *EXTERN*" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Richard Broersma Jr *EXTERN*" <rabroersma(at)yahoo(dot)com>, <rongkai(dot)zhao(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Rule vs Trigger
Date: 2007-06-26 15:46:02
Message-ID: AFCCBB403D7E7A4581E48F20AF3E5DB2038C52E6@EXADV1.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>> A trigger FOR EACH STATEMENT will execute the trigger function
>> for each row affacted by the statement.
>
> Huh? That would be true for a FOR EACH ROW trigger, but a STATEMENT
> trigger fires once per statement.

Argh. I intended to write FOR EACH ROW.
Thanks for the correction.

>> A rule would only
>> execute one additional statement. So if you can do it with a rule
>> conveniently, the rule will probably be faster.
>
> I find this unlikely. The overhead involved in setting up a rule
> is probably larger than that involved in calling a trigger.
> The real question is whether you need access to the modified data
> or not --- a statement-level trigger doesn't currently get that.

Yes, I meant to write about row level triggers, maybe what
I wrote makes more sense then...

What I said was inspired by chapter 35.6. of the documentation.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Fernando Hevia 2007-06-26 16:15:16 Re: NO DATA FOUND Exception
Previous Message Harald Fuchs 2007-06-26 15:33:39 Re: Duplicate records returned