model-writtenrun 7192 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andres Freund traced severe high-concurrency performance collapse to LWLockDequeueSelf() scanning long wait lists and proposed three waiting states so a backend could remove itself directly while holding the wait-list lock #1.
- Kyotaro Horiguchi supported the design but observed that an int enlarged PGPROC, recommending byte-sized storage; Bharath Rupireddy independently measured substantial gains and reported a sporadic background-writer crash #2 #4.
- Pavel Borisov and Alexander Korotkov raised a parallel lockless-queue approach, whose current results were weaker than Andres's patch, but that alternative was not incorporated into this thread's implementation #5 #6.
- Andres revised the patch to include the missing LWLockUpdateVar() transition, named waiting states, and uint8 storage, then explained that using the enum directly would generally require four bytes under the supported C standard #8 #10.
- Bharath approved and benchmarked the revised patch, proposed additional state checks and assertions, and later repeated both transaction-ID and insertion benchmarks; Andres rejected enumerating every waiting state because it would increase maintenance without improving robustness #12 #18 #19.
- Backpatching remained contentious: Robert Haas warned about unexpected workload regressions, Jonathan S. Katz suggested limiting exposure or allowing more testing, and Andres emphasized that the quadratic slowdown was unusually difficult for users to diagnose #13 #14 #15.
- Andres's insertion benchmarks showed substantial gains even with synchronous commits enabled, strengthening the case beyond the original synthetic workload, while Jonathan favored allowing further testing before a stable release #16 #17.
- Andres committed the revised patch as a4adc31f69, adding two assertions, a comment, and fuller commit documentation, but deferred backpatching because consensus was still unclear #21.
- In January 2024, Nathan Bossart revived backpatching after field reports and more than a year of experience with the fix; Michael Paquier and Jonathan supported proceeding based on affected workloads and the unchanged PGPROC size #23 #24 #25.
- Michael prepared PostgreSQL 12–15 adaptations, checked the LWLock paths, and benchmarked all stable branches, confirming severe deterioration without the fix and large improvements at high connection counts #26 #28.
- Michael announced completion of the PostgreSQL 12–15 backports and checked external uses of lwWaiting for compatibility; Jakub Wartak subsequently reported up to roughly 2.65-fold gains in another contention-heavy benchmark, and the thread ended with Michael acknowledging those results and no remaining patch work identified #29 #30 #31.