model-writtenrun 4836 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tomas Vondra proposed moving postgres_fdw ANALYZE sampling to the remote server in #1, demonstrating substantial transfer savings with TABLESAMPLE SYSTEM while identifying stale row estimates and partition sample allocation as unresolved concerns.
- Tom Lane required compatibility with servers predating TABLESAMPLE in #2 and defended retaining that compatibility against Robert Haas's concerns in #3 and #4; Tomas consequently added server-version checks and a random() fallback in #8.
- Sofia Kopikova suggested correcting row estimates using relation size and consolidating duplicated SQL-generation code in #7, while Fujii Masao's recommendation to use PQserverVersion in #9 immediately simplified the series in #11.
- After several months, Tom Lane rebased the patch in #13 and challenged SYSTEM as the default because of sample quality, also requesting a shared deparser, documentation, and better handling of row estimates.
- Tomas Vondra's rework in #14 introduced off, auto, random, system, and bernoulli modes, with auto choosing BERNOULLI on newer servers, and consolidated SQL generation; custom sampling extensions remained deferred because detection and parameter handling would complicate the implementation.
- Tom Lane supplied a review delta in #15 that improved calculation flow, row-count reporting, and documentation, accepting raw reltuples estimates with sampling disabled for nonpositive values; broader changes to partition sample allocation were explicitly deferred in #17.
- Tomas Vondra folded in that review in #18, simplified costly regression tests, and removed the near-full-sample cutoff after measurements showed that avoiding network transfer generally outweighed remote sampling overhead.
- Jim Finnerty endorsed the feature but questioned its arbitrary 10% sample inflation in #19; after further discussion, Tomas announced the feature landing in #22 with that inflation removed because it neither adequately repaired stale estimates nor addressed their underlying cause.
- Tom Lane found a leftover comment describing the removed inflation and questioned TABLESAMPLE compatibility with remote views and sequences in #23 and #25, prompting Tomas's two-patch repair series in #27.
- Tom Lane reviewed both repairs in #28, proposing a simpler range assertion and clearer function names; the comment/assertion component of #27 landed as 211d80c065 with that assertion adjustment.
- Tomas resubmitted the remaining relkind check in #31, adding the requested renames and preserving random() sampling for auto mode when TABLESAMPLE is unsupported, while allowing explicitly requested TABLESAMPLE methods to fail; Tom endorsed the revised patch in #32.
- The relkind patch from #31 landed as 57d11ef028 with only a function-comment edit, and Tomas confirmed the push in #34.
- By the thread's end, the feature and both repairs had landed, while sampling relations without usable row estimates remained future work: Tomas discussed ORDER BY random() and correlation concerns in #33 and #34, and Tom proposed obtaining remote planner estimates through EXPLAIN in #35.