Repository navigation
fix(planner): account for probe fanout in join index costing - #32231
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 9a78ab47fd030942d654f47caa8526e7aaea8c04
Assessment: approve
Join-index admission now accounts for estimated probe fanout through the existing cost model. It preserves hints and statistics fallbacks, and retains established plans when residual evaluation safety is unproven. The added logic stays within the existing planner owner; no actionable defects found.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
Validation:
-
Reviewed all four changed files, linked issue #32013 and both discussion items, including independent plan and SQL oracles.
-
Reused exact-head successful build, UT, SCA, coverage and proxy/pessimistic BVT results after confirming planner and optimizer-case selection.
-
Local formatting, whitespace and source/discussion/55-statement SQL-pair audits passed. Receipts and retained logs are reconciled in validation-ledger.json.
-
Assessed the supplied paired performance measurements, high-NDV control and reported two-CN execution evidence.
Limitations:
-
Local Go, SQL and benchmark runs were not repeated; frozen-head CI and supplied author evidence were assessed separately.
-
NDV-based estimates remain approximate for skewed or correlated data. Reported timings predate the residual-safety follow-up and do not establish the original incident's exact speedup ratio.
🚫 Left the queue · pull request dequeued1 h 20 min in the queue, with no time running CI. So far
Reason Pull request #32231 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
To get back in the queue
Merge conditions not met when it left the queue
Tick the box to put this pull request back in the merge queue (same as
2 merge conditions met
Times in UTC · dashboard · how the merge queue works |
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32013
What this PR does / why we need it:
A small semijoin build can match many rows of a low-NDV probe index. Admitting index backfill based on build cardinality alone can overflow the backfill runtime filter, leaving a full table scan behind an extra dependency and a single-CN placement constraint.
Estimate matching probe rows before publishing join-index candidates, then apply the existing backfill capacity and preparation-cost model. Preserve selective indexes, FORCE/IGNORE hints, and the existing fallback for unavailable statistics. Composite-key estimates do not assume independent columns. Only reject an existing index path when every probe-scan residual has proven stable evaluation; otherwise retain the path so invalid JSON on nonmatching rows is not newly evaluated. No runtime-filter execution protocol changes are needed.
Validation (Go 1.27.1, darwin/arm64):
pkg/sql/plansuite passes throughmo-cgo-testafter merging the latest main.Paired local measurements of the initial cost-admission change (before the residual-safety follow-up), on the same persisted/analyzed data, with two warmups and seven interleaved samples per query:
Low-NDV plans no longer have the index-backfill dependency or its
ForceOneCNconstraint. The high-NDV control retains index access and reads 100 probe rows. These are local medians, not a claim to reproduce the original report's exact 27x ratio; estimates remain conservative for skewed/correlated data.