Repository navigation
Introduce RelationStatsCache - #122259
Open
cv4g wants to merge 2 commits into
Open
Introduce RelationStatsCache#122259cv4g wants to merge 2 commits into
RelationStatsCache#122259cv4g wants to merge 2 commits into
Conversation
Contributor
|
Workflow [PR], commit [e12d8c4] Summary: ❌
AI ReviewSummaryThis PR adds a pass-local Missing context / blind spots
Final Verdict✅ No new inline findings. LLVM Coverage ReportMeasured on commit e12d8c4.
Changed lines: Changed C/C++ lines covered: 257/272 (94.49%) · Uncovered code |
cv4g
commented
Sep 25, 2026
cv4g
force-pushed
the
relation-stats-cache
branch
from
September 25, 2026 16:01
4176edc to
c619a82
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracted from #121736.
This PR adds a pass-local
RelationStatsCacheand threads it through the join optimization pipeline. Join reordering, legacy join optimization, runtime-filter planning, andIEJoinphysical planning can now reuse statistics for the same relation subtrees.The cache:
RelationStatsOptions::propagate_join_estimatesmodes (required to not regress on join order optimization Revert #97114 Move join step row estimation before check for 1 child" #99957).RelationStatsunaffected bypropagate_join_estimates, such as table-read statistics, are cached for both modes.RelationStatsrequest-local when derived through mutable joins and common-subplan references, preventing their reuse after plan rewrites (RelationStatsCache::Entry::invocation).PREWHERE, parallel-replica, anddistributed-plan rewrites, preventing reuse of stale pre-rewrite entries without requiring those rewrites to
implement cache invalidation.
IEJoinkey selection reuses input statistics already computedduring join optimization.
Callers outside the the join-optimization phase of
optimizeTreeSecondPassretain the previous behavior through a temporary local cache.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog.
Workflow [PR]
Sync PR [sync-upstream/pr/122259]