model-writtenrun 9148 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Martijn van Oosterhout opened this thread with separate listener-list and notification-performance patches, plus testing-only instrumentation, reporting a 20–25% CPU reduction from lazy tail updates, database-specific signaling, and waking slow listeners individually #1.
- Tom Lane committed the listener-list component as bca6e64354, correcting types, invalid sentinels, and insertion ordering while preserving BackendId order for cache locality; Martijn then rebased the remaining performance patch #2 #3.
- Tom identified compiler warnings, questioned the page-boundary trigger and cleanup flag, and proposed waking the slowest listener; Martijn revised the selection logic, removed the unused variable, documented unregister safety, and explained why cleanup must occur after transaction locks are released #4 #5.
- Further discussion exposed disagreement over who should guarantee cleanup: Tom initially favored relying on awakened listeners, while Martijn explained how idle databases could leave the tail stalled and how repeated cleanup attempts could create contention #6 #7.
- Tom supplied a substantial rewrite that made senders advance the tail every four pages, removed tail advancement from listeners, and signaled all sufficiently lagging foreign-database listeners through SignalBackends(); his testing found the clearest benefit in reducing cross-database signaling #8.
- Martijn initially worried that waking many lagging listeners together would recreate contention and suggested a larger cleanup interval, but accepted the rewrite after Tom pointed out that listeners would now acquire only shared locks; the four-page interval remained #9 #10 #11.
- Tom committed the rewrite from #8 as 51004c7172 with only comment and whitespace changes, then confirmed that both improvements were headed for PostgreSQL 13; the testing-only instrumentation from #1 was not included, and no further work remained under discussion #12.