Re: NOTIFY command impact

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Rob Brucks <rob(dot)brucks(at)rackspace(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: NOTIFY command impact
Date: 2017-02-21 22:55:00
Message-ID: c3a2f451-2750-ce62-1bd5-5c5603db9c9f@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/21/2017 02:43 PM, Rob Brucks wrote:
> That's a great thought!
>
> Comparing between systems (one where I don't issue "notify" and one where I do every minute) yields the same thing: one 8k file named "0000".
>
> If that's truly where notifications are stored, then it looks like I should be good, at least for storage. But I wonder if that file is only used to store notify commands during shutdown/startup?

From the source of async.c:

During start or reboot, clean out the pg_notify directory.

I would guess the 0000 file is like a WAL file it is a pre-initialized
file filled with 0(?)'s

>
> Or if there are any considerations for memory usage…
>
> --Rob
>
> On 2/21/17, 4:38 PM, "Adrian Klaver" <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>
> On 02/21/2017 02:19 PM, Rob Brucks wrote:
> > I did find a post a while back saying they were discarded, but I wanted
> > to double-check.
> >
> >
> >
> > I performed some tests to see if listens worked AFTER the notify was
> > issued, they were not. This leads me to believe that the messages are
> > discarded when a listen does not yet exist.
>
> Seems the thing to do would be to monitor the size of :
>
> $PG_DATA/pg_notify/
>
> >
> >
> >
> > --Rob
> >
> >
> >
> > *From: *"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
> > *Date: *Tuesday, February 21, 2017 at 3:38 PM
> > *To: *Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
> > *Cc: *Rob Brucks <rob(dot)brucks(at)rackspace(dot)com>,
> > "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
> > *Subject: *Re: [GENERAL] NOTIFY command impact
> >
> >
> >
> > On Tue, Feb 21, 2017 at 2:17 PM, Adrian Klaver
> > <adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
> >
> > On 02/21/2017 01:07 PM, Rob Brucks wrote:
> >
> >
> > Do you see any long-term problems with constantly issuing "NOTIFY"
> > commands every 30 seconds without an associated "LISTEN" command?
> >
> >
> >
> > Depending on how long 'long term' is:
> >
> > https://www.postgresql.org/docs/9.6/static/sql-notify.html
> >
> > "There is a queue that holds notifications that have been sent but
> > not yet processed by all listening sessions
> >
> >
> >
> > ​Its not clear in the OP that this is the case (it seems to be) but the
> > documentation is non-specific as to what happens when "# of listeners" =
> > 0; I suspect that said messages are created and then immediately
> > discarded - though apparently they do make it over to the standby server
> > ​ too - and likely also immediately discarded there as well.
> >
> >
> >
> > David J.
> >
> >
> >
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-02-21 23:03:52 Re: NOTIFY command impact
Previous Message Rob Brucks 2017-02-21 22:47:49 Re: NOTIFY command impact