| From: | "Josh Berkus" <josh(at)agliodbs(dot)com> | 
|---|---|
| To: | Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org | 
| Subject: | Re: Rules and Triggers | 
| Date: | 2002-05-16 15:12:26 | 
| Message-ID: | web-1461719@davinci.ethosmedia.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
Ludwig,
>   I tried converting the rule to function & trigger
> and it reported that it used an Index scan given the
> same INSERT statement.
> 
>    I was wondering why the rule used sequentail scan
> and the equivalent function trigger used index scan.
This is one of the documented differences between rules and triggers
(at least, I've seen it in the documentation *somewhere*).  I can't
tell you "why", though ... hopefully Tom or Bruce will speak to that.
For myself, I use triggers for most things, and rules just for
updatable views.  Aside for index efficiency, rules are a Postgres-only
thing, whereas several RDBMS's support triggers.   Gives me marginally
better portability.
-Josh Berkus
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Larry Rosenman | 2002-05-16 17:38:13 | trigger question | 
| Previous Message | juerg.rietmann | 2002-05-16 12:38:02 | how to build this list ? |