Re: Rules/Trigges Trade-offs

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
Cc: Richard Huxton <dev(at)archonet(dot)com>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Rules/Trigges Trade-offs
Date: 2002-12-06 17:41:07
Message-ID: 200212061741.gB6Hf7121431@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql


No, the rule will affect all the rows using one query.

---------------------------------------------------------------------------

Jean-Luc Lachance wrote:
> Thanks for the info.
>
> Do you mean that if an update affects more than one row I should use
> triggers because the rules will be executed only once?
>
> JLL
>
>
> Richard Huxton wrote:
> >
> > On Friday 06 Dec 2002 4:03 pm, Jean-Luc Lachance wrote:
> > > Hi all!
> > >
> > > Is there a guideline on the use of rules compared to triggers when both
> > > can be use to achieve the same result?
> >
> > If I can use rules I do. Rules rewrite the query so are processed once,
> > whereas triggers get processed for every row.
> > --
> > Richard Huxton
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tim Frank 2002-12-06 18:38:28 Re: PAM
Previous Message Jean-Luc Lachance 2002-12-06 17:30:15 Re: Rules/Trigges Trade-offs

Browse pgsql-sql by date

  From Date Subject
Next Message FatTony 2002-12-06 18:05:34 order by a "select as" determined by case statement
Previous Message Jean-Luc Lachance 2002-12-06 17:30:15 Re: Rules/Trigges Trade-offs