Re: Rule vs Trigger - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Rule vs Trigger
Date
Msg-id AFCCBB403D7E7A4581E48F20AF3E5DB2038C52E6@EXADV1.host.magwien.gv.at
Whole thread Raw
In response to Re: Rule vs Trigger  (Richard Broersma Jr <rabroersma@yahoo.com>)
List 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

pgsql-general by date:

Previous
From: "Sergey Karin"
Date:
Subject: pg_catalog.pg_get_serial_sequence() returns NULL
Next
From: Harald Fuchs
Date:
Subject: Re: Duplicate records returned