Repository navigation
perf: bound repeated work in analytic queries - #28752
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? |
5222ef2 to
231ec9a
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 9dbdf6ff03fdcb87bec4a98b9aa30a158b200e86. P2 — provide the focused, reproducible performance evidence required by RFC v10 (lines 568–582). The PR gives three TPC-DS elapsed times, but I could not find the base/candidate revisions, raw comparable outputs, and nearest unchanged control needed to evaluate the changed hash-join projection hot path and expanded planner admission. A representative focused benchmark is sufficient; alternatively show the applicable paths were unchanged and reuse valid measurements. This does not require fixed percentage targets, p50/p95, blanket telemetry, or the full TPC-H corpus. I found no remaining concrete semantic blocker, and I found no ~45s single-test or material racing-UT regression: exact-head race UT passed in 48m01s and rollup.sql took 2.446s (227 pass, 1 ignored).
|
Addressed on rebased head I reused the measurements already produced during this iteration and added their raw summaries, tested revisions, statement IDs, and output/plan checks to the PR body. In particular:
The original and rebased HashJoin/CTE commits have identical stable patch IDs, so those earlier measurements remain applicable; the current benchmark was rerun after the rebase. RFC v11 now makes the acceptance rule explicit: use the same SQL or the same fixture's legacy path as the comparison. An unrelated or merely adjacent TPC query is not a meaningful control. Rejected shapes remain covered by focused fallback/correctness tests. The branch is also rebased onto current |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed exact head 7b4041e2f4f3afea39b318775f9227daf56c8db2. The new evidence closes my prior P2: it provides same-fixture scalar/batch raw benchmark results with revisions plus same-query planner A/B timings, read counts and output evidence. I verified the CTE original/replay stable patch IDs and that the only relevant implementation delta since the earlier review consistently gates on MORPC v68. No correctness, lifecycle or resource blocker found. Exact-head CI run 34808745097 passed (race UT 51m42s); no newly added ~45s test or major racing-UT regression mechanism found.
Merge Queue Status
This pull request spent 7 minutes 23 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Requeued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 54 minutes in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #26768.
What this PR does / why we need it:
Large analytic plans can repeat the same CTE/grouping work, miss safe early pruning, project unique hash matches row by row, and retain a full partition for a small
RANKbound. This PR addresses those mechanisms generically:RANK <= Nsemantics by retaining boundary ties, with chunked output, accounted state, and an MORPC v68 compatibility gate.No query ID is encoded in these rules. Statistics participate only in conservative cost/admission decisions, never in semantic legality. Unsupported, uncertain, mixed-version, or over-budget shapes keep the previous plan. The design and counterexample matrix are recorded in the stats-independent analytic rewrite RFC v11 (exact revision).
Existing direct performance evidence
The evidence is mechanism-local: the same SQL on base/candidate code, or old/new methods on the same benchmark fixture. Unrelated TPC queries are not treated as controls.
HashJoin projection was measured on the same 256-row/eight-column fixture with
GOMAXPROCS=4using:This was run on production/test tree
71d4359cb4; current head7b4041e2f4changes only this RFC. The earlier SQL A/B used basee99ed4148fand hash-join candidate45564cc78f; the latter has the same stable patch ID as rebased commit5a644c3230:The planner admission changes also have same-query evidence. For Q2 1T, base statement
01a03cea-dd7f-74a1-98cc-033cfe1e66bdtook 1980.838s and read 4,320,253,780 rows / 51,845,382,928 bytes; candidate statement01a03d4f-43f5-7f24-a5cc-4823fb8792b3took 855.284s and read 2,160,199,939 rows / 25,923,275,856 bytes. Both returned 2513 rows. The CTE change is carried unchanged by original commit8dfcc396d5and rebased commit48fb4d2e29(identical stable patch ID).The consolidated candidate was also run on the isolated 1T TPC-DS lab with 128 MiB operator spill limits, merge disabled, a 20 GiB no-swap cgroup, and memory/OOM monitoring. Raw terminal summaries were:
Q14a's ordinary plan reduced fact-table scans from 63 to 15. Q14b retained the original
SINGLEcardinality check while moving its scalar predicate to the date input; the 1G base/candidate output SHA-256 was identical (a581011fcc880666be34f0dda56a8836443b0d71573701a7c7f9c3ca06228d8e). Focused rejected-shape tests, rather than unrelated neighboring queries, verify legacy fallback.The latest revision removes decimal
SUM(SUM(v))prefix reuse. Checked fixed-width addition is not associative in error semantics: a finer partial sequence can overflow even when the raw coarser input succeeds through cancellation. Dynamic grouping-set expansion remains available because each grouping set consumes raw rows in their original order.After rebasing onto current
main, MORPC v67 was already allocated to named process timezone identity, so boundedRANKmoved to v68 and the protobufs were regenerated. Focused v67/v68 fallback and recursive remote validation tests pass. The unique HashJoin projection correctness/reuse/allocation tests and the benchmark above also pass. The pre-rebase exact-head CI was green; CI for the rebased head is pending.