model-writtenrun 6119 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Jan - Apr 2026 · 17 entries
- David Geier opened the thread with eight GIN and pg_trgm optimizations, reporting roughly threefold faster index creation on movie plots and a 1.59-fold improvement on shorter TPC-H strings, while identifying the red-black-tree accumulator as future work #1.
- Heikki Linnakangas identified a missing NULL-result check, an invalid assumption that absent null flags implied sorted unique keys, and collation problems with ASCII lowercasing #2, while Kirill Reshke reported whitespace defects and independently measured the inlining benefit #3.
- David's revised series added an explicit sorted-and-unique indication to the extraction API and fixed the reported defects, but its measurements showed that skipping the extra sort did not improve performance #4.
- Heikki committed the unchanged inlining member of #4 as bba81f9d3d and supplied an alternative ginExtractEntries implementation that removes NULLs before sorting ordinary Datums #6.
- David accepted Heikki's NULL-handling approach and suggested zero-initialized categories #7, then incorporated it with templated sorting and qunique_arg while dropping both the extraction-API shortcut and cached function-call optimization because their measured benefits were absent #9.
- The ASCII fast path exposed broader collation questions: Heikki explained that ICU lowercasing can depend on surrounding characters #8, David moved collation work to another thread #10, and Matthias van de Meent explained that affected indexes would require user-managed reindexing rather than automatic rebuilding by pg_upgrade #11.
- David returned with a March rebase and removed the ASCII fast path because correct handling was more complicated than expected #13, then removed an incorrect radix-sort assertion #14.
- Heikki committed the GIN extraction member of #14 with light comment edits as 6f5ad00ab7, and combined its templated trigram-sort and equality-comparator members with new helper functions as 9f3755ea07 #15.
- The branchless integer comparator remained pending because Heikki questioned whether pg_cmp_s32 universally improved generated code #15, and John Naylor pointed out that the cautionary comparison-function documentation was recent #16.
- Bertrand Drouvot noticed that the landed GIN optimization introduced a deprecated StaticAssertStmt and proposed moving its replacement to file scope #17; Peter Eisentraut asked to retain its connection to palloc0_array #19, producing the block-scoped revision #20.
- Tom Lane reported a Coverity warning that most of ginExtractEntries appeared unreachable because the analyzer failed to recognize modification of its local output argument #18, and Heikki suspected PointerGetDatum's const-qualified inline-function argument #25.
- After David approved the revised assertion fix #21, Heikki committed #20 with minor comment and diagnostic-string edits as 66ad764c8d and announced the landing #28.
- David supplied assembly and profiling evidence that branchless btint4cmp reduced mispredicted branches when invoked through the function manager #29, then resent only that optimization and radix sort as the uncommitted remainder #30.
- Heikki proposed an inline macro definition restoring PointerGetDatum's former behavior while retaining pointer-argument checking #31; Peter questioned the API contract #34, Tom favored a minimal experiment #36, and Andres Freund warned against silently redefining existing callers' semantics #37.
- Tom accepted trying the macro #39, and Heikki committed the discussion-derived change as d65995cbc6, leaving type-specific wrappers alone #40.
- Heikki confirmed that the macro eliminated the Coverity warning, while leaving separate const/non-const APIs and backpatching open for further consideration #41.
- David expanded the remaining series with a simplehash-based GIN accumulator followed by sorting, reporting further substantial gains and successful regression and amcheck results, while raising image-equality assumptions and possible removal of the now-unused red-black-tree implementation #42.
Sep - Nov 2026 · 11 entries
- After a four-month gap, David rebased the three pending optimizations #43; Japin Li requested extending branchless comparison to int8 and fixing style and typedef registration #44, which David incorporated #45.
- Matthias requested commit explanations, consistent size types, unsigned-character radix sorting, lower memory use, and correction of unnecessary copied hash keys #48; David implemented the concrete fixes while defending an auxiliary radix buffer as a per-string allocation #49.
- Matthias then suggested combining deduplication with the radix sort's final copy and sharing the specialized item-pointer sorter #50; David reported that an in-place radix-sort experiment regressed performance by more than 30% and retained a simpler change that deduplicates the temporary buffer before copying unique trigrams back #51.
- David rebased the same three pending patches in October: branchless int4/int8 comparison, trigram radix sorting, and the hash-based GIN accumulator #52.
- Heikki committed the branchless int4/int8 comparison member of #52 as 41467b1d88, with only include-order and commit-message edits, and dismissed possible JIT-related concerns unless someone demonstrated a measurable problem #53.
- Heikki considered the radix sort's bounded memory increase probably worthwhile, suggested combining deduplication with copying and trying int32 counters, and identified a small-array slowdown requiring a fix, possibly by retaining qsort for small inputs #54.
- David's November revision retained the hash accumulator, dropped the committed integer comparators, and added optimized trigram comparators alongside buffered LSD and in-place American Flag sorting variants, both using insertion sort below 64 elements; he reported that this removed the short-word regression, while buffered sorting remained substantially faster for long movie plots #55.
- Kirill found that the hash accumulator separated semantically equal numeric values with different byte images, reporting an approximately 7.35-fold larger index and 4.08-fold longer build on numeric arrays #57, then reported another regression for repeated long text keys and identified hash_bytes as the main CPU cost #58.
- David explained that comparator-based insertion still merges semantically equal keys in the index, preserving correctness but moving costly TID merging out of memory; he proposed merging adjacent equal keys after sorting the hash entries, while leaving open whether the regression justified that extra pass and rejecting a universal hashability requirement #59.
- David benchmarked faster hash functions for long keys: fasthash32 and xxhash3 reduced the regression but still trailed master on repeated identical strings, whereas the hash accumulator won on his varying-string example; he suggested fasthash32 and fixed-length hashing optimizations while treating broader hash-function integration as separate work #60.
- At the thread's end, the hash accumulator, new trigram comparators, and radix-sort alternatives remain uncommitted, with no revised patch addressing the numeric and long-key regressions or settled choice between the sorting variants #55 #59 #60; reusable item-pointer sorting and red-black-tree cleanup also remain open topics #50 #49.