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: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-01-14T02:44:57Z
Lists: pgsql-hackers
I've been studying the v34 patch all day, and there is one change I don't think I agree with. It looks to me like the new logic in SignalBackends will have the effect of wakening any idle backend that is not up-to-the-moment. This seems like a pretty awful idea for use-cases where there are many backends that aren't interested in particular notifications. In particular it's totally discarding the previous concept of allowing idle backends in other databases to sleep for quite a long while. If we are able to do a direct advance, then great; but if we can't, I don't think that an immediate forced wakening is a good idea. That backend will already be stuck with reading through some data it doesn't care about, but I don't see how forcing it to do that work in small bites improves matters. We're trying to reduce the number of wakeups, not increase it. I think that if we have a backend that isn't interested in our notifications, and we can't direct-advance it, we should apply the same behavior that was previously used for backends in other databases. That was basically a conservative approximation to "isn't interested", and I don't see why it wouldn't work fine when we have a more accurate idea of "isn't interested". regards, tom lane
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