Re: listen/notify argument (old topic revisited)

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Jeff Davis <list-pgsql-hackers(at)empires(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: listen/notify argument (old topic revisited)
Date: 2002-07-03 02:10:05
Message-ID: 200207030210.g632A5B07250@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Davis wrote:
> On Tuesday 02 July 2002 06:03 pm, Bruce Momjian wrote:
> > Let me tell you what would be really interesting. If we didn't report
> > the pid of the notifying process and we didn't allow arbitrary strings
> > for notify (just pg_class relation names), we could just add a counter
> > to pg_class that is updated for every notify. If a backend is
> > listening, it remembers the counter at listen time, and on every commit
> > checks the pg_class counter to see if it has incremented. That way,
> > there is no queue, no shared memory, and there is no scanning. You just
> > pull up the cache entry for pg_class and look at the counter.
> >
> > One problem is that pg_class would be updated more frequently. Anyway,
> > just an idea.
>
> I think that currently a lot of people use select() (after all, it's mentioned
> in the docs) in the frontend to determine when a notify comes into a
> listening backend. If the backend only checks on commit, and the backend is
> largely idle except for notify processing, might it be a while before the
> frontend realizes that a notify was sent?

I meant to check exactly when it does now; when a query completes.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-07-03 06:08:29 Re: Integrating libpqxx
Previous Message Jeff Davis 2002-07-03 02:02:58 Re: listen/notify argument (old topic revisited)