Re: [GENERAL] Rule vs Trigger

2007-06-26 Thread Joshua D. Drake
Tom Lane wrote: "Albe Laurenz" <[EMAIL PROTECTED]> 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 prob

Re: [GENERAL] Rule vs Trigger

2007-06-26 Thread Albe Laurenz
>> 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 w

Re: [GENERAL] Rule vs Trigger

2007-06-26 Thread Tom Lane
"Albe Laurenz" <[EMAIL PROTECTED]> writes: > Richard Broersma Jr wrote: >> 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. Huh? That would be true for a FOR EAC

Re: [GENERAL] Rule vs Trigger

2007-06-26 Thread Albe Laurenz
Richard Broersma Jr wrote: > --- Alfred Zhao <[EMAIL PROTECTED]> 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

Re: [GENERAL] Rule vs Trigger

2007-06-25 Thread Richard Broersma Jr
--- Alfred Zhao <[EMAIL PROTECTED]> 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 trig

[GENERAL] Rule vs Trigger

2007-06-25 Thread Alfred Zhao
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. Alfred ---

Re: [GENERAL] RULE vs TRIGGER

2001-07-30 Thread Stephan Szabo
On Mon, 30 Jul 2001, will trillich wrote: > i have a solution using RULES and PLGPSQL functions (instead of > triggers) for insert-unless-found, using perl lingo: > > # perlish pseudoCode > unless (select(tbl.fld == val)) { insert tbl.fld = val }; > > i'd love to hear the skinny on

[GENERAL] RULE vs TRIGGER

2001-07-29 Thread will trillich
i have a solution using RULES and PLGPSQL functions (instead of triggers) for insert-unless-found, using perl lingo: # perlish pseudoCode unless (select(tbl.fld == val)) { insert tbl.fld = val }; i'd love to hear the skinny on why the following is a bad idea, which i presume it i