pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adam Tauno Williams <awilliam@whitemice.org>
To: pgsql-general@lists.postgresql.org
Subject: Re: Asynchronous Trigger?
Date: Fri, 30 Mar 2018 06:00:51 -0400
Message-ID: <1522404051.3217.1.camel@whitemice.org> (raw)
In-Reply-To: <CAG_=8kAdbc_DoJWy11xh5J8b+v-ZWSt3Ty-1Ffdn4scgq3wK6Q@mail.gmail.com>
References: <CAG_=8kAdbc_DoJWy11xh5J8b+v-ZWSt3Ty-1Ffdn4scgq3wK6Q@mail.gmail.com>

On Thu, 2018-03-29 at 22:29 +0000, Cory Tucker wrote:
> Is it possible to have the execution of a trigger (or any function)
> not block the completion of the statement they are associated with?
> A pattern I had hoped to implement was to do a quick update of rows
> that signaled they needed attention, and then an async per-row
> trigger would come and do the maintenance (in this case, make an
> expensive materialized view).

This is a good use of a Notification.  A trigger can queue a
notification, which can be received by a listening process - which can
then determine and do whatever is necessary.

See the "LISTEN" documentation.


-- 
Adam Tauno Williams <mailto:awilliam@whitemice.org> GPG D95ED383
OpenGroupware Developer <http://www.opengroupware.us/;




view thread (11+ messages)  latest in thread

Message-ID: <1522404051.3217.1.camel@whitemice.org>
Permalink:  ../1522404051.3217.1.camel@whitemice.org/
Also on:    postgresql.org/message-id/1522404051.3217.1.camel@whitemice.org

 · 

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: awilliam@whitemice.org
  Subject: Re: Asynchronous Trigger?
  In-Reply-To: <1522404051.3217.1.camel@whitemice.org>
  References: <CAG_=8kAdbc_DoJWy11xh5J8b+v-ZWSt3Ty-1Ffdn4scgq3wK6Q@mail.gmail.com> <1522404051.3217.1.camel@whitemice.org>

* 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