model-writtenrun 3468 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- alex work reported that PostgreSQL 16 GRANT ROLE operations took seconds with tens of thousands of roles, compared with milliseconds on PostgreSQL 15, and supplied a reproducer in #1.
- Tom Lane traced the slowdown to exhaustive role-membership traversal and quadratic catalog-cache list searches in #3, then demonstrated that older releases also suffered expensive membership-cache initialization in #4; Wolfgang Walther reported multi-minute SET ROLE delays and cancellation trouble on PostgreSQL 15 in #5.
- Tom introduced expandable hash buckets for CatCList objects in #6, reducing his problematic GRANT to roughly 250 milliseconds, then identified list_append_unique_oid() as the remaining quadratic bottleneck in #7.
- Nathan Bossart explored SIMD acceleration in #8 and initially reported little benefit in #9, while Tom proposed using the existing Bloom-filter implementation to avoid most linear membership searches in #10.
- Nathan's first Bloom-filter patch in #12 improved GRANT performance but slowed role creation, prompting Tom to recommend delaying filter creation until roughly 1000 roles and avoiding redundant filter insertions in #14.
- Nathan incorporated those recommendations in #15, corrected his earlier SIMD comparison because it had omitted the hash-table patch, and reported that hashing plus the Bloom filter alone reduced GRANT time to about 40 milliseconds in #16.
- Nathan and Tom agreed to prioritize the hash-table fix for PostgreSQL 16 while reserving the more elaborate optimization for a development release in #18 and #19; Nathan approved the hash-table patch in #21, and it landed unchanged from #6 as 473182c952, with an ABI-preserving PostgreSQL 16 backport in 14e991db89.
- When Nathan resumed the Bloom-filter work for PostgreSQL 17 in #23, Tom deferred a reusable list/filter API until more use cases existed and requested threshold testing, comments, and removal of duplicated logic in #24.
- Nathan supplied a documented helper and a named 1024-entry threshold in #26; Tom's experiments supported that threshold but exposed unsafe static filter state after errors, leading him to request a local pointer in #27.
- Nathan adopted the local pointer in #28, and Tom approved it with a clarification of the filter's probabilistic behavior in #29; Nathan committed that version with only the comment change as d365ae7054 and confirmed the landing in #30.
- Ranier Vilela subsequently proposed an explicit admin_role null check in #31, attributing a possible dereference problem to the Bloom-filter commit, but Nathan explained that the existing admin_of invariant already prevents the dereference in #32.
- Nathan also explained that Ranier's patch incorrectly removed the guard preserving the first qualifying administrative role in #34; Ranier restored that condition in #35, leaving this separate cleanup proposal unresolved at the end of the thread while both performance optimizations had landed.