Repository navigation
perf(plan): restrict correlated aggregates to qualifying keys - #32816
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? |
|
Queue requested — the merge queue status continues in this comment ↓. |
Conclusion: aggregate membership domain restrictionQ20 wall changes -74.32%/-75.76%/-34.27%, user instructions Investigating the SF100 controlsPrimary Q13/Q16 wall medians were +5.71%/+12.36%. Most slower controls have nearly A separate UNSCORED Q20 -> Q13 -> Q16 history probe brackets this branch with
Q13 is essentially equal; Q16 wall lies between main references, with lower CPU Measurement scopeFresh current main One process per arm/configuration, one excluded cold Q1–Q22 suite followed by five Primary timings include GC and instrumentation. Total sums per-query medians; Exact service pins
sf10-memory: all 22 queries, Total, CPU, instructions and allocations
Allocation counters include common process/scrape and asynchronous engine work. No globally exact copy-byte counter is available. GC CPU is measured process GC CPU, not a wall-time subtraction. | Query | Main Go MB | Candidate Go MB | Go bytes Δ | Main Go objects | Candidate Go objects | Main GC CPU s | Candidate GC CPU s | Native allocation attribution limit: the default allocator publishes counters after a 100 ms window; MPool publishes after a one-second window. Their query-boundary increments are retained in raw JSON, but can belong to neighboring queries. They are not exact per-query allocation evidence and are not used to declare a per-query allocation pass. IO/cache counters overlap the default allocator and must not be added again. Long-window native totals also have endpoint lag; exact per-query native costs need separate operator/component evidence.
Faults/system CPU/read bytes belong to the measured application. THP fallback counts are host-wide supporting evidence; they neither automatically invalidate a result nor excuse an introduced resource regression. External process cores: main 0.442, candidate 0.488; interrupt cores separately: 0.355, 0.342. GC attribution uses period-weighted instruction samples; non-GC figures are estimates, not exact foreground counters. Raw hardware instructions are above.
sf10-disk: all 22 queries, Total, CPU, instructions and allocations
Allocation counters include common process/scrape and asynchronous engine work. No globally exact copy-byte counter is available. GC CPU is measured process GC CPU, not a wall-time subtraction. | Query | Main Go MB | Candidate Go MB | Go bytes Δ | Main Go objects | Candidate Go objects | Main GC CPU s | Candidate GC CPU s | Native allocation attribution limit: the default allocator publishes counters after a 100 ms window; MPool publishes after a one-second window. Their query-boundary increments are retained in raw JSON, but can belong to neighboring queries. They are not exact per-query allocation evidence and are not used to declare a per-query allocation pass. IO/cache counters overlap the default allocator and must not be added again. Long-window native totals also have endpoint lag; exact per-query native costs need separate operator/component evidence.
Faults/system CPU/read bytes belong to the measured application. THP fallback counts are host-wide supporting evidence; they neither automatically invalidate a result nor excuse an introduced resource regression. External process cores: main 0.425, candidate 0.505; interrupt cores separately: 0.351, 0.330. GC attribution uses period-weighted instruction samples; non-GC figures are estimates, not exact foreground counters. Raw hardware instructions are above.
sf100-disk: all 22 queries, Total, CPU, instructions and allocations
Allocation counters include common process/scrape and asynchronous engine work. No globally exact copy-byte counter is available. GC CPU is measured process GC CPU, not a wall-time subtraction. | Query | Main Go MB | Candidate Go MB | Go bytes Δ | Main Go objects | Candidate Go objects | Main GC CPU s | Candidate GC CPU s | Native allocation attribution limit: the default allocator publishes counters after a 100 ms window; MPool publishes after a one-second window. Their query-boundary increments are retained in raw JSON, but can belong to neighboring queries. They are not exact per-query allocation evidence and are not used to declare a per-query allocation pass. IO/cache counters overlap the default allocator and must not be added again. Long-window native totals also have endpoint lag; exact per-query native costs need separate operator/component evidence.
Faults/system CPU/read bytes belong to the measured application. THP fallback counts are host-wide supporting evidence; they neither automatically invalidate a result nor excuse an introduced resource regression. External process cores: main 0.791, candidate 0.342; interrupt cores separately: 0.627, 0.610. GC attribution uses period-weighted instruction samples; non-GC figures are estimates, not exact foreground counters. Raw hardware instructions are above.
All five primary warm wall times for every querysf10-memory
sf10-disk
sf100-disk
|
🛑 Queue command cancelledQueue requested — the merge queue status continues in this comment ↓. |
🛑 The queue request has been cancelled: new commits were pushedDetails@aunjgr pushed to this pull request after |
|
Resolved the current-main conflict in The owning planner package passes, including the membership, grouped-measure and outer-count rewrite cases (27.305 s). The full pinned pre-push static gate passes with zero issues. The domain/prefix implementation is unchanged; no benchmark rerun or numerical claim is added, and the earlier measurements retain their original source/ELF pins. |
|
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: e68d2e14bc61168dbccc1dd52706f550aa3f9692
Assessment: approve
The rewrite reuses existing safety proofs and SEMI execution, with a cost gate for the additional scan. The LIKE fast path preserves existing semantics while removing folding allocations. No actionable correctness or design defects remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed the complete ten-file delta, affected consumers, design and all seven discussion entries; discussion-assessment.json records their disposition.
-
Full planner/function package tests, focused snapshot/join/rejection probes, build, vet and formatting passed.
-
Five-query independent SQLite oracle and 9,216,512-case prefix differential passed. Disabling the planner hook fails Q20 reachability as expected.
-
Paired prefix microbenchmarks reduced 256-row ASCII allocations from 260 to 2 and Unicode allocations from 1028 to 2; fallback control allocation counts were unchanged.
-
Frozen-head CI metadata reports build, UT, SCA, coverage and multi-CN BVT success.
-
Source remained unchanged. Native provenance, receipts and retained logs reconcile in validation-reconciliation.json; final audit receipt: checks/1794891170218436567-2.json.
Limitations:
-
Full-service/all22 performance was not rerun locally. Published measurements precede the latest merge; core files match, but whole-head performance equivalence is unverified. Slower Q13/Q16 signals remain acknowledged.
-
The relational oracle used SQLite. Raw author/CI execution artifacts were unavailable; historical reviewer-harness failures and the expected baseline failure are retained and classified.
✅ Merged into
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #30843
What this PR does / why we need it:
Restrict a correlated aggregate to keys already required by a positive membership
predicate. Copy the filtered base-table key domain at the same snapshot and add
a SEMI join below aggregation, retaining the original membership and scalar
comparison. Preserve every surviving key's aggregate-input bag, including
duplicate domain rows, composite groups, NULLs and missing/all-NULL groups.
Require direct compatible integer keys, safe aggregate inputs and a strictly
profitable domain scan/build/probe estimate. Keep the original plan for unsupported
or unprofitable cases. Bind the full proposal before publication and let ordinary
later planning create fresh distribution/runtime-filter dependencies.
Avoid repeated folded-string allocations in the qualifying scan's constant
general-ci literal-prefix LIKE evaluator. Compare existing character weights
directly, with an ASCII fast path and the existing behavior for other patterns,
collations, ESCAPE and dynamic inputs.
Design
Approved domain-restriction and prefix-evaluation design.
Validation
The owning planner and function packages pass on current main. Typed tests cover
binding/snapshot identity, equality/correlation mapping, duplicate restriction,
existing restrictions and unsafe/unprofitable cases. Prefix evaluator tests
preserve general-ci weights, Unicode/malformed-byte behavior, NULLs and fallbacks.
Configured static checks pass for both changed packages.
The existing independent SQL oracles cover duplicate/NULL domain keys, missing
groups, all-NULL SUM, composite correlations and predicate/unsafe-form boundaries.
Their semantic feature logic remains unchanged by the main merge; fresh service
comparisons cover the updated scan/cache environment.
The local comparison covers all 22 queries and Total at SF10 memory/disk and
SF100 disk, with one process per configuration, one excluded cold suite and five
profiled warm suites. The original slower-control signals are retained alongside a separate unscored
Q20/Q13/Q16 history probe with unchanged main binaries bracketing this branch.
It did not reproduce a stable control penalty. The mandatory full pre-push
static gate passes with repository-pinned tools in the default CI build mode.
All-query results, source pins and attribution limits are in separate comments.