Repository navigation
perf(sql): reduce analytical join and aggregation overhead - #31761
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? |
0f16a3e to
0d24447
Compare
|
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: 0d244477f6daa17edfc574cbfbec525018680b5e
Assessment: request_changes
The complete delta was read. A mandatory design amendment is missing for the new optimizer and execution capabilities.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
- P2
pkg/sql/plan/query_builder.go:4480: The PR introduces set-membership reduction, grouping-expression motion, deep ordinary runtime filters and parallel UNION ALL projection across planner/compiler boundaries. These additions exceed the repository’s feature-design size and complexity triggers.
Impact: Implementation approval requires a reviewed design covering their composition, evaluation-domain safety, publisher startup/completeness and resource costs. Amend the existing analytic RFC, including the RIGHT-join batching extension, and link the reviewed revision and decision from this PR.
Evidence: .agents/skills/mo-dev/references/feature-design-review.md:22-89 requires this gate. The existing analytic RFC covers scalar runtime filters at docs/rfcs/00000000_stats_independent_analytic_plan_rewrites.md:446 and explicitly excludes outer/unmatched-output joins from batching at line 488. No amendment covering the new scope appears in the frozen delta or supplied discussion.
Validation:
-
Read all 62 changed files and supplied discussion/linked-issue context; saved review-plan.md and discussion-assessment.json.
-
Artifact/source-integrity check passed: checks/1793329162663464731-2.json, exit 0, matching review-artifact-check.log. Verified frozen head, clean source, patch equivalence, diff whitespace and complete discussion coverage.
-
Frozen CI snapshot reports successful build, unit tests, SCA and multi-CN BVT.
Limitations:
-
Downstream implementation approval and local execution testing were deferred at the mandatory design gate; no demonstrated runtime defect is claimed.
-
Author-reported performance and race results were not independently verified from retained execution logs.
0d24447 to
c45ec08
Compare
165d691 to
742d604
Compare
Preserve distinct-set aggregation spill and key contracts; keep disabled runtime filters disabled; bound string-cast recovery reservations; invalidate stale hash-key proofs; drain stopped shuffle producers; clear inherited sorted metadata when inputs are combined.
Batch canonical CHAR and fixed-composite hash keys, streamline integer probes, copy inline varlena selections in batches, and reduce per-row selection metadata work.
Use stable heap selection for sorted partitions; batch grouping markers, join probe/finalization projections and fixed-width CASE null runs; avoid unnecessary scalar min/max scratch and saturated COUNT cache probes.
Reduce duplicate-insensitive joins to set membership after join ordering, preproject pure UNION ALL branches before fan-in, and evaluate total grouping expressions below build-side fanout.
Admit deep runtime filters only on proven local execution trees and preserve totality guards while allowing bounded text widening.
742d604 to
e0369d5
Compare
|
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: e0369d5078b7c5b444364c76422a52e84d1a1ed7
Assessment: approve
Completed the 63-file review and relevant consumer traces. The design amendment resolves the previous review concern; no actionable defects or unmet required contracts remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
Reviewed semantic guards, runtime-filter publication and cleanup, operator lifecycle, memory ownership, and regression-test oracles.
-
Reused frozen-head CI evidence reporting successful build, UT, SCA, coverage and multi-CN BVT checks.
-
Source/artifact audit passed: exact HEAD, clean source, complete delta coverage and all five discussion keys assessed. Receipt: checks/1793436492061726382-3.json; output: review-audit.log.
-
Saved review-plan.md, review-evidence.md and discussion-assessment.json.
Limitations:
-
No fresh local product tests or benchmarks were run.
-
Raw CI and author validation logs were unavailable; author-reported race tests and historical performance results were not independently reproduced.
-
Skipped CI jobs were not counted as passes.
✅ Merged into
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #26768.
What this PR does / why we need it:
Reduce repeated analytical join/aggregation work with general optimizations, without query-specific rules or increasing DOP.
Design: analytic-execution-v1, revision
c45ec08a42. Addresses the design-amendment review; amendment approval is pending in this PR, with the design decision recorded before implementation approval.TPC-DS 1T measurements on host 129:
These five query files total 2,268.403 -> 1,055.998 seconds: 53.4% less time, saving 20 minutes 12 seconds. Outputs match retained references; Q64 passed six post-fix reference comparisons.
Measurement sources: main
553bf39dbband retained pre-rebase integration checkpoints. Both use aggregation 4 GiB / automatic join / sort 512 MiB, automatic DOP, GOGC=200, merge OFF and a 232 GiB cgroup. These are instrumented per-query measurements.General changes:
TPC-H regression validation:
64de090862: all 22 golden-result checks passed at both 100G and 1T; formal average times were 85.496 s / 876.094 s.Post-rebase validation passes for all 14 affected packages and vector/hashjoin/Partition/shuffle/compiler under race.