Re: Optimize LISTEN/NOTIFY

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Chao Li" <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimize LISTEN/NOTIFY
Date: 2025-12-26 20:12:40
Message-ID: 6e538502-81c8-453b-ba6d-be2a5ce85e9e@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 25, 2025, at 21:17, Tom Lane wrote:
> "Joel Jacobson" <joel(at)compiler(dot)org> writes:
>> It looks to me like it would be best with two boolean fields; one
>> boolean to stage the updates during PreCommit_Notify, that each
>> pendingActions could flip back and forth, and another boolean that
>> represents the current value, which we would overwrite with the staged
>> value during AtCommit_Notify.
>
> +1, I had a feeling that a single boolean wouldn't quite do it.
> (There are various ways we could define the states, but what
> you say above seems pretty reasonable.)

I've implemented the two boolean approach and think it's good.

The signals arrays are now preallocated during PreCommit_Notify.

More details in the patch message under "Two-phase staging pattern".

/Joel

Attachment Content-Type Size
0001-optimize_listen_notify-v31.patch application/octet-stream 9.3 KB
0002-optimize_listen_notify-v31.patch application/octet-stream 53.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Jeff Davis 2025-12-26 19:33:21 Re: NLS: use gettext() to translate system error messages