model-writtenrun 8840 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Julien Rouhaud opened the thread with a planner-side patch that dropped GIN quals requiring a full index scan when another conjunct could drive a selective scan, motivated by Marc Cousin's production problem with short LIKE patterns #1.
- After Julien rebased the patch, Tomas Vondra and Tom Lane objected to adding GIN-specific knowledge to indxpath.c; Tom proposed handling the decision inside the index access method at scan startup, where runtime comparison values are available #2 #3 #5 #7.
- Nikita Glukhov supplied a replacement that suppressed empty ALL-mode scan keys inside GIN and forced heap rechecks when needed, while Julien spotted that its forcedRecheck flag could incorrectly reset and Alexander Korotkov identified a multicolumn NULL-handling problem #9 #11 #17.
- Marc demonstrated the production impact: adding a two-character LIKE condition increased execution time from roughly 35 milliseconds to 18 seconds; Tom subsequently argued that improving EXPLAIN's account of ignored quals should not delay the optimization and requested comment and recheck fixes #20 #21.
- Julien incorporated the initial corrections, then Tom fixed missing forced rechecks for pending-list entries and added tests proving that multicolumn NULL values could still produce wrong answers #23 #25 #27.
- Tom and Alexander favored unconditional rechecks when discarding ALL qualifiers, while Alexander clarified that nonempty ALL queries were valid for negated text-search terms #27 #28 #29.
- Nikita split the work into three patches covering the simple unconditional-recheck fix, more precise NULL and recheck handling, and optimization of nonempty ALL queries using reference-counted scan entries #30.
- Tom revised the first patch but withheld commitment because replacing ALL scans with EVERYTHING scans could regress NULL-heavy indexes, and he challenged the complexity and assumptions of the other patches while suggesting deferred handling of ALL keys #31.
- After several months, Nikita returned with four patches and benchmarks showing that unconditional rechecks had substantial overhead; he separated NULL handling from recheck suppression and replaced reference counting with deferred hidden entries and new list-merging logic, while acknowledging uncertainty about lossy pages #33.
- Alexander rewrote the implementation around excludeOnly scan keys, preserving index-side filtering while omitting unnecessary full-scan entries and reusing the existing tests #36.
- Nikita reviewed Alexander's rewrite and demonstrated a severe multicolumn regression with many NULLs, which Tomas independently reproduced while also confirming benefits on a mailing-list archive with trigram indexes #38 #39.
- Alexander restricted the optimization to scan keys on the same index column, preserving existing NULL handling and deferring broader cross-column optimization until a suitable cost-based choice among NULL-handling strategies could be developed #40.
- Regression failures exposed stale expected results, so Alexander changed the tests to compare sequential and bitmap scans; Julien then compiled and tested the patch, reviewed its logic, and requested clearer comments and equivalent pg_trgm cross-checks #43 #44 #46.
- Tom refined the comments and made regression output portable after testing on a 32-bit machine, noting that the tests checked correctness but did not distinguish the optimization from unpatched behavior #47.
- Alexander added a shortcut that skips excludeOnly checks for lossy pages and identified a separate asymmetry in combining lossy pages with exact tuple identifiers, explicitly leaving that issue for another patch #48 #49.
- Tom supplied final comment wording and raised lossy-page test coverage; Alexander found that even a minimal example required a very large table, so they declined to add such a regression test and Tom accepted the final version #50 #51 #53.
- Alexander committed the complete final patch as 4b754d6c16, with an identical source diff to #51 and only two commit-message spelling edits, and confirmed the push in the thread's last message; cross-column NULL optimization and lossy-page ordering improvements remained future work #54 #40 #49.