From: | Joachim Wieland <joe(at)mcknight(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Listen / Notify - what to do when the queue is full |
Date: | 2009-11-19 01:06:53 |
Message-ID: | dc7b844e0911181706h62129748m6e519bf7c686611e@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Nov 19, 2009 at 1:48 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Joachim Wieland <joe(at)mcknight(dot)de> writes:
>> 4) Allow readers to read uncommitted notifications as well.
>
> The question that strikes me here is one of timing --- apparently,
> readers will now have to check the queue *without* having received
> a signal? That could amount to an unpleasant amount of extra overhead
> when the notify system isn't even in use. (Users who don't care about
> notify will define "unpleasant amount" as "not zero".)
The sequence in CommitTransaction() is like that:
1) add notifications to queue
2) commit to clog
3) signal backends
Only those backends are signalled that listen to at least one channel,
if the notify system isn't in use, then nobody will ever be signalled
anyway.
If a backend is reading a transaction id that has not yet committed,
it will not deliver the notification. It knows that eventually it will
receive a signal from that transaction and then it first checks its
list of uncommitted notifications it has already read and then checks
the queue for more pending notifications.
Joachim
From | Date | Subject | |
---|---|---|---|
Next Message | KaiGai Kohei | 2009-11-19 01:09:28 | Re: TRIGGER with WHEN clause |
Previous Message | Greg Stark | 2009-11-19 01:04:46 | Re: Listen / Notify - what to do when the queue is full |