pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Ludwig Lim <lud_nowhere_man@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: Re: Rules and Triggers
Date: Thu, 16 May 2002 08:12:26 -0700
Message-ID: <web-1461719@davinci.ethosmedia.com> (raw)
In-Reply-To: <20020516045940.41862.qmail@web20402.mail.yahoo.com>

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



view thread (8+ messages)  latest in thread

Message-ID: <web-1461719@davinci.ethosmedia.com>
Permalink:  ../web-1461719@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-1461719@davinci.ethosmedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, lud_nowhere_man@yahoo.com
  Subject: Re: Rules and Triggers
  In-Reply-To: <web-1461719@davinci.ethosmedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox