Re: Rule vs Trigger

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Albe Laurenz <all(at)adv(dot)magwien(dot)gv(dot)at>, 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 16:18:08
Message-ID: 46813C40.6020602@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at> writes:
>> Richard Broersma Jr wrote:

>> 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.

Not that Tom ever needs any backing up, but when we started testing
partitioning, we first tested with rules and then tested with triggers.
Triggers are quite a bit faster than rules.

Joshua D. Drake

>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org/
>

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Broersma Jr 2007-06-26 16:48:49 View Triggers
Previous Message Fernando Hevia 2007-06-26 16:15:16 Re: NO DATA FOUND Exception