From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Jean-Luc Lachance <jllachan(at)nsd(dot)ca> |
Cc: | pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Rules/Trigges Trade-offs |
Date: | 2002-12-06 23:25:49 |
Message-ID: | 200212061525.49284.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-sql |
Bruce, Richard,
> Triggers are mostly for testing/modifying the row being
> inserted/updated, while rules are better for affecting other rows or
> other tables.
Hmmm. Thought that there were also some other criteria:
1) Rules can't use indexes to do their processing, so Rules which query large
secondary tables can be a bad idea (maybe this has changed?)
2) Only Rules can "DO INSTEAD"; thus, only Rules are good for defining
Read/Write views.
3) There are no AFTER Rules, making, for example, a rule with a table check on
the new data impractical, so you'd want to use Triggers or Constraints
etc.
There are, IMHO, some things Rules are better for, and some things Triggers
are better for. I tend to use all Triggers except for updatable views,
simply because using a mix of Rules and Triggers can be very hard to keep
track of, but YMMV.
--
-Josh Berkus
Aglio Database Solutions
San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-12-06 23:30:13 | Re: Rules/Trigges Trade-offs |
Previous Message | Tom Lane | 2002-12-06 20:00:54 | Re: list schema |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-12-06 23:30:13 | Re: Rules/Trigges Trade-offs |
Previous Message | Tom Lane | 2002-12-06 23:00:24 | Re: SELECT FOR UPDATE locks whole table |