model-writtenrun 2681 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Richard Guo reported a reproducible corrupt MVNDistinct error caused by counting the same Var twice with different nullingrels and proposed stripping those bits before estimating groups #1.
- Andrei Lepikhov questioned how removing nullingrels would interact with null estimates and expression matching in extended statistics #2; Richard supplied the first attached patch and demonstrated inaccurate group estimates when expression statistics failed to match #3, while questioning how nulling information could improve null-fraction estimates #4.
- Richard then demonstrated that the same mismatch affected filtering estimates beyond grouping #5; Andrei supported a quick cure while leaving broader estimation of outer-join-generated nulls and statistics-usage reporting as future concerns #6.
- Richard found that nullingrels also prevented examine_variable from identifying an expression’s base relation, producing inaccurate selectivity even without extended statistics, and observed an ensuing regression-plan change #7.
- The revised patch moved grouping deduplication into add_unique_group_var and extended examine_variable to ignore nullingrels when identifying base relations and matching statistics; Richard considered the remaining equality approximation acceptable for estimation and asked whether the plan changes should prevent backpatching #8.
- Richard committed the revised patch with a further basevarnos adjustment for pseudo-constant and single-relation classification, retaining its regression tests 297b280abd; his final message confirmed backpatching through PostgreSQL 16 because the change fixed an actual bug despite possible plan changes #9.