model-writtenrun 7905 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tomas Vondra opened the thread with OR-estimation improvements, same-relation Var-op-Var support, and unfinished expression statistics; the expression patch stored column keys separately from expressions, while he asked whether treating everything as expressions would simplify the implementation #1.
- The March revision polished the first two features, but Tomas deferred expression statistics beyond PostgreSQL 13 because substantial work remained and then removed that patch because it broke automated testing #3 #4.
- Dean Rasheed found that OR estimates incorrectly multiplied statistics-object selectivities and returned one when no statistics applied; Tomas supplied regression cases and corrections that initialized OR selectivity to zero and used the OR combination formula #5 #7.
- A related discussion exposed functional-dependency estimates exceeding an individual column estimate, leading Dean to propose a minimum-based probability formula and a separate prototype that estimated both implying and implied attributes #8 #9 #10.
- Dean's review identified duplicated OR-estimation loops, so Tomas extracted a shared helper and packaged independent MCV and functional-dependency test improvements alongside the feature patches #11 #12.
- The two standalone test patches from #12 landed unchanged as f9696782c7 and d8cfa82d51, after which Tomas resent the remaining OR and Var-op-Var work #13.
- Thomas Munro reviewed wording in the Var-op-Var patch and asked about single-expression statistics for JSON; Tomas confirmed that expression statistics were planned for PostgreSQL 14, while the existing-code wording correction landed separately as 6f72dbc48b #14 #15.
- Dean caught an incorrect initial selectivity of one in the extracted OR helper, which Tomas corrected; they also agreed to preserve existing public selectivity APIs and keep OR-specific processing separate #16 #17 #18.
- Following Dean's suggestion, Tomas added deterministic tests whose MCV lists covered only part of the data, exposing behavior hidden by earlier tests with complete MCV coverage; this submission contained only the OR patch #18 #19.
- Dean then found that recursive selectivity calls could apply extended-statistics corrections twice, and further analysis showed that the existing base-frequency correction was inappropriate for OR combinations; Tomas proposed explicitly disabling extended statistics during simple estimates, while Dean recommended preserving the public API through wrappers #20 #21 #22 #23.
- The functional-dependency prototype from #10 was followed by later submissions in thread #41872, including #445511; the eventual refactored implementation and IN-clause tests in 87779aa474 are attributed to that later development rather than this thread's prototype.
- After a gap, Tomas rebased the OR patch in July but explicitly left the March design problems unresolved, then returned in November with WIP patches propagating a flag to prevent repeated extended-statistics evaluation #26 #27.
- Dean took over the implementation, fixed a missed caller, and consolidated the growing collection of simple and internal functions into variants with one optional extended-statistics flag, keeping clause-tracking details internal #29.
- Tomas accepted hiding the clause bitmap but questioned the proposed function names; Dean proposed the shorter _ext suffix used by the subsequent revisions #30 #31.
- Dean replaced the flawed OR correction with explicit union-minus-overlap estimation using MCV match bitmaps, avoiding the previously contemplated change to stored statistics and substantially improving partial-MCV estimates #32.
- After Tomas's comment review, Dean extracted mcv_combine_selectivities(), refined corrections for individual multicolumn clauses, and added tests, while discovering that missing RestrictInfos prevented direct handling of AND clauses beneath OR clauses #33 #36.
- The final main patch from #36 landed with all nine files unchanged as 25a9e54d2d, crediting Tomas's original work and Dean's improvements; Dean announced the landing in #38.
- Dean followed with two incremental patches: one corrected combination across separate statistics objects, and the other taught relation and compatibility checks to descend through bare AND clauses beneath OR clauses #39.
- Tomas responded to both follow-ups before they landed, and both commits explicitly credit his review: 88b0898fe3 changes only comment wording from the first patch, while 4f5760d4af matches the second patch unchanged #39 #40.
- At the last message, the main OR work had landed and its two follow-ups were awaiting their same-day commits; Var-op-Var support remained uncommitted in this thread, and expression statistics remained deferred work #36 #40.