Re: what are rules for?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Adam Rich <adam(dot)r(at)sbcglobal(dot)net>
Cc: "'Michael Shulman'" <shulman(at)mathcamp(dot)org>, "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: what are rules for?
Date: 2008-06-24 14:44:08
Message-ID: 20080624144408.GA4822@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adam Rich wrote:

> One interesting example is having rules and triggers watching for
> deletes or updates on a table. If many rows are modified, rules
> can be faster. Take this statement:
>
> DELETE FROM mydata WHERE idval BETWEEN 10000 and 20000;
>
> Say this statement deletes 10,000 rows. The delete trigger would
> get called 10,000 times whereas the rule is essentially executed
> once, since it can share the WHERE clause of the user's query.

This is a use case we should be able to better implement using FOR EACH
STATEMENT triggers, it seems. We just need to be able to pass the list
of affected tuples to the trigger function, which until now has remained
unimplemented.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-06-24 15:04:25 Re: backslashes in 8.3.3
Previous Message Brandon Metcalf 2008-06-24 14:34:44 Re: backslashes in 8.3.3