Re: Triggers on transaction? - Mailing list pgsql-hackers

From hubert depesz lubaczewski
Subject Re: Triggers on transaction?
Date
Msg-id 20150527110717.GB4853@depesz.com
Whole thread Raw
In response to Re: Triggers on transaction?  (Jordan Gigov <coladict@gmail.com>)
Responses Re: Triggers on transaction?  (Benedikt Grundmann <bgrundmann@janestreet.com>)
List pgsql-hackers
On Wed, May 27, 2015 at 01:55:24PM +0300, Jordan Gigov wrote:
> Updating a materialized view in my case. It should only update when 2-3 of
> our 30+ tables get new data, which for those is kind of rare. Not having
> such a trigger means I will have to call it in each usage in the code and
> hope future maintainers don't forget it. This is why I postponed migrating
> the one search query where materialized views would be useful, because it's
> heavy.

Add daemon which runs "LISTEN", and triggers on the underlying tables
that do NOTIFY.
When daemon picks something from LISTEN (which happens only after
commit) - it can do anything that needs to be done, and it will not
block the transaction, which is an added benefit.

depesz



pgsql-hackers by date:

Previous
From: Jordan Gigov
Date:
Subject: Re: Triggers on transaction?
Next
From: Benedikt Grundmann
Date:
Subject: Re: Triggers on transaction?