Re: Optimize LISTEN/NOTIFY
Joel Jacobson <joel@compiler.org>
From: "Joel Jacobson" <joel@compiler.org>
To: "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-07T05:39:08Z
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 →
-
Optimize LISTEN/NOTIFY via shared channel map and direct advancement.
- 282b1cde9ded 19 (unreleased) landed
-
Fix incorrect logic for caching ResultRelInfos for triggers
- 39dcfda2d23a 19 (unreleased) cited
Attachments
- optimize_listen_notify-v9.patch (application/octet-stream) patch v9
On Mon, Oct 6, 2025, at 22:22, Joel Jacobson wrote: > On Mon, Oct 6, 2025, at 22:11, Joel Jacobson wrote: >> The patch is now using dshash. I've been looking at code in launcher.c >> when implementing it. The function init_channel_hash() ended up being >> very similar to launcher.c's logicalrep_launcher_attach_dshmem(). > > Noticed a mistake on one line just after pressing send. > Sorry about that, new version attached. Trying to fix the NetBSD failure. I don't understand why 001_constraint_validation, test 'list_parted2_def scanned' and test 'part_5 verified by existing constraints' should be affected by this patch. I guess I could have gotten something wrong with the locking with dshash, that might somehow affect other tests? I've changed the dshash_find() in SignalBackends from dshash_find(..., false) to dshash_find(..., true), that is, to take an exclusive lock instead. Not sure if this is necessary, since we're not modifying the entry, but we're already holding an exclusive lock on NotifyQueueLock here, so I don't think it should affect concurrency. Any help on looking specifically at the dshash code would be much appreciated, since I'm new to this interface. /Joel