From: | "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at> |
---|---|
To: | "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 09:12:50 |
Message-ID: | AFCCBB403D7E7A4581E48F20AF3E5DB2038C4AD7@EXADV1.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Richard Broersma Jr wrote:
> --- Alfred Zhao <rongkai(dot)zhao(at)gmail(dot)com> wrote:
>> Suppose I want to update a statistics table S after an
>> insertion into an activity table A. In order to update S
>> automatically, I can either create a rule on A or create
>> an after trigger on A. What's the performance implication
>> on using rule vs trigger? Thanks in advance.
>
> My understanding is that Triggers offer better performance
> than rules do.
A trigger FOR EACH STATEMENT will execute the trigger function
for each row affacted by the statement. A rule would only
execute one additional statement. So if you can do it with a rule
conveniently, the rule will probably be faster.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | don romanos | 2007-06-26 09:49:25 | |
Previous Message | Albe Laurenz | 2007-06-26 09:08:36 | Re: postgresql varchar[] data type equivalent in Oracle |