Re: NOTIFY in Background Worker

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, jacques klein <jacques(dot)klei(at)googlemail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NOTIFY in Background Worker
Date: 2015-11-03 08:52:26
Message-ID: CAFj8pRBTEOg3vqb_aF=n4gHqJg9LCRXpkx3DmtK=aNhkVasysA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2015-11-03 9:35 GMT+01:00 Andres Freund <andres(at)anarazel(dot)de>:

> On 2015-11-03 17:19:43 +1100, Haribabu Kommi wrote:
> > On Sat, Aug 29, 2015 at 12:55 PM, Thomas Munro
> > <thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> > > On Sat, Aug 29, 2015 at 9:03 AM, Thomas Munro
> > > <thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> > > This made me wonder what happens if a background worker calls LISTEN.
> > > NotifyMyFrontEnd simply logs the notifications, since there is no
> remote
> > > libpq to sent a message to. Perhaps a way of delivering to background
> > > workers could be developed, though of course there are plenty of other
> kinds
> > > of IPC available already.
> >
> > With this commit - bde39eed0cafb82bc94c40e95d96b5cf47b6f719, it is not
> possible
> > to execute Notify commands inside a parallel worker. Can't we change
> > it as disable both listen and notify commands inside a background worker?
>
> Well, parallel workers are something different from general background
> workers. I don't see why it'd make sense to allow listen/notify there,
> given the rest of the restrictions?
>

I though about this possibility and I am thinking, so NOTIFY can be pretty
useful there.

The background workers can be used for running AT TIME tasks - run import
every 10 minutes. The notification can be useful for starting AFTER tasks
where the required previous steps should be committed.

If we use workers more for execution custom code (PLpgSQL, PLPython, ...)
then notification mechanism can be interesting (both directions).

Regards

Pavel

Andres
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2015-11-03 08:52:34 Re: NOTIFY in Background Worker
Previous Message Craig Ringer 2015-11-03 08:45:58 Re: pglogical_output - a general purpose logical decoding output plugin