pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Rules versus triggers
Date: Mon, 9 Mar 2020 09:02:14 +0200
Message-ID: <57571cc1-80c8-2496-483e-ee38425f7aee@matrix.gatewaynet.com> (raw)
In-Reply-To: <CALL-XePeFfzP6HMJUSmrcHW5gm+OBAnZGuhCAK+=WL+a_xb4OQ@mail.gmail.com>
References: <20200307115615.GA27155@panix.com>
	<CALL-XeORpZyTBLSjn-vw5Xhs_cKdv-P-WB420xbWiGwC57MA3A@mail.gmail.com>
	<20200307145718.GB10796@panix.com>
	<CALL-XePeFfzP6HMJUSmrcHW5gm+OBAnZGuhCAK+=WL+a_xb4OQ@mail.gmail.com>

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@panix.com <mailto:stanb@panix.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

view thread (6+ messages)

Message-ID: <57571cc1-80c8-2496-483e-ee38425f7aee@matrix.gatewaynet.com>
Permalink:  ../57571cc1-80c8-2496-483e-ee38425f7aee@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/57571cc1-80c8-2496-483e-ee38425f7aee@matrix.gatewaynet.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: achill@matrix.gatewaynet.com
  Subject: Re: Rules versus triggers
  In-Reply-To: <57571cc1-80c8-2496-483e-ee38425f7aee@matrix.gatewaynet.com>
  References: <20200307115615.GA27155@panix.com> <CALL-XeORpZyTBLSjn-vw5Xhs_cKdv-P-WB420xbWiGwC57MA3A@mail.gmail.com> <20200307145718.GB10796@panix.com> <CALL-XePeFfzP6HMJUSmrcHW5gm+OBAnZGuhCAK+=WL+a_xb4OQ@mail.gmail.com> <57571cc1-80c8-2496-483e-ee38425f7aee@matrix.gatewaynet.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