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