Re: Rules versus triggers

From: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Rules versus triggers
Date: 2020-03-09 07:02:14
Message-ID: 57571cc1-80c8-2496-483e-ee38425f7aee@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/3/20 5:01 μ.μ., Justin wrote:
> Yes a rule can rewrite query or replace the query
>
> Read through Depesz  post about rules and the weird side affects that can occurr
> https://www.depesz.com/2010/06/15/to-rule-or-not-to-rule-that-is-the-question/
>
IMHO Rules are cool. It allows for more elegant design (vs doing it otherwise) and it results in faster queries. In our system we have currently 61 rules and 331 triggers.
>
>
> On Sat, Mar 7, 2020 at 9:57 AM stan <stanb(at)panix(dot)com <mailto:stanb(at)panix(dot)com>> wrote:
>
> On Sat, Mar 07, 2020 at 09:47:39AM -0500, Justin wrote:
> > Hi Stan
> >
> > Rules actual are able to rewrite the SQL query sent to postgresql.  Most
> > everyone suggestion is avoid rules.
> >
> > Triggers are just like every other databases Triggers firing off code for
> > Insert/Update/Delete/Truncate event
> > https://www.postgresql.org/docs/current/sql-createtrigger.html
> >
>
> So, the RULE can actually rewrite the query, instead of replacing it,
> which is what I m doing in the function, correct?
> --
> "They that would give up essential liberty for temporary safety deserve
> neither liberty nor safety."
>                                                 -- Benjamin Franklin
>

--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josef Machytka 2020-03-09 08:51:21 strange locks on PG 11 with Golang programs
Previous Message Christoph Moench-Tegeder 2020-03-08 23:01:50 Re: Real application clustering in postgres.