Re: Optimize LISTEN/NOTIFY

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Joel Jacobson" <joel@compiler.org>
Cc: "Matheus Alcantara" <matheusssilv97@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-08T18:46:16Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Optimize LISTEN/NOTIFY via shared channel map and direct advancement.

  2. Fix incorrect logic for caching ResultRelInfos for triggers

"Joel Jacobson" <joel@compiler.org> writes:
> On Tue, Oct 7, 2025, at 22:15, Tom Lane wrote:
>> 5. ChannelHashAddListener: "already registered" case is not reached,
>> which surprises me a bit, and neither is the "grow the array" stanza.

> I've added a test for the "grow the array" stanza.

> The "already registered" case seems impossible to reach, since the
> caller, Exec_ListenCommit, returns early if IsListeningOn.

Maybe we should remove the check for "already registered" then,
or reduce it to an Assert?  Seems pointless to check twice.

Or thinking a little bigger: why are we maintaining the set of
channels-listened-to both as a list and a hash?  Could we remove
the list form?

			regards, tom lane