Repository navigation
Description
Parent Issue
Detail of Subtask
Evidence reassessment — 2026-10-26
Current delivery/performance status: STRUCTURAL DESIGN OPPORTUNITY, not an established missing DuckDB feature or measured speedup.
Observed: Pinned SF100 Q18 plans for both engines scan LINEITEM twice, each about 600.04M rows, to qualify and later report SUM(quantity). Thus grouped-measure reuse may remove repeated work in MO, but is not an existing cross-engine scan-count advantage. Existing scalar-aggregate fusion rejects the grouped/HAVING case.
Not yet established: Whether the first measure can legally replace the final one through the actual joins and filters, and whether any alternative state/materialization cost outweighs the removed scan.
Next discriminating experiment: Prove identical aggregate input bags, key-preserving join multiplicities, type/NULL semantics and reachable eligibility on current main. Compare actual scan/group/probe work before and after, including the cost of carrying the measure.
Measured target: Eligible unchanged Q18-shaped SQL with demonstrably removed repeated measure work and lower query CPU/latency.
Mandatory controls and total cost boundary: Duplicate/nullable dimension keys, missing dimensions, changed filters, HAVING boundaries, NULL/all-NULL values, decimal limits, ordering/LIMIT and memory cost.
Performance acceptance and rejection
- Freeze current-main/candidate sources, executables, real caller shapes and effective settings. Use the unchanged qualification SQL and complete result consumption; exclude cold runs and keep profiles separate from latency scoring.
- Demonstrate the named work/CPU reduction and an attributable uninstrumented target-query improvement. Include the controls below and full Q1-Q22 comparison; component wins, source changes, functional tests, SCA, merging and profile percentages are separate evidence.
- A confirmed affected/control slowdown fails; unresolved slower signals are inconclusive. Confirm with an independent longer balanced run. No gain elsewhere, favorable average or self-approved tolerance waives a regression.
- Complete applicable SF10/SF100 and memory/mixed-I/O acceptance before issue closure under the umbrella protocol. Report uncertainty, absolute CPU/instructions/work, allocations/copies and the same whole-application budget, effective cache, I/O/spill/swap/pressure evidence. Benchmark scripts do not verify input/table/schema/row counts/reference results/checksums.
Semantics and lifecycle requirements retained
- A reviewed design states exact aggregate-input equality/containment and join multiplicity proofs, public reachability, type/null semantics, and conservative rejection cases before implementation.
- First inspect/rebaseline current main: if another change already eliminates the work, extend its eligibility/proof rather than adding a second optimizer mechanism.
- For eligible unchanged Q18-shaped SQL, native plans demonstrate removal of the second fact-table scan and the corresponding repeated measure computation; unchanged ineligible plans retain correct execution.
- Independent small UT/BVT cover one-to-many/duplicate dimension rows, nullable keys, missing dimensions, changed filters, NULL/all-NULL quantities, decimal boundaries, HAVING boundaries and ordering/LIMIT.
- Measure same-host warm CPU/instructions, scan/probe/group work, peak memory and uninstrumented Q18 latency, with a non-eligible control. No 2× claim follows merely from removing one of two scans.
Describe implementation you've considered
Reuse existing proof/remapping infrastructure to carry a proven grouped measure. Reject one-to-many, changed-input or insufficient-proof cases. Compare with current two-pass execution; do not add a Q18-specific rewrite or claim a 2x speedup from two scans.
Coordination: #30842 owns identical producer sharing; #30847 kernel updates; #30844 join work. Eliminate work before stacking unrelated loop tuning.
Additional information
- Reassessed profile/caller evidence and delivery ledger.
- Historical MO source
873282742714436bff407dfcdbbe879147162bd3; DuckDB069cc9f9b5be802405797faecc284961b07c70ef. SF10 all-query profiles; SF100 results/profiles; mixed-I/O evidence. These are pinned historical captures, not current-main scores. - No new query/benchmark was run for this reassessment. Foreground query work, engine background maintenance, kernel CPU and off-CPU waits must be distinguished; all remain inside whole-application resource accounting.
Activity
aunjgr commentedon Nov 16, 2026
Implementation submitted as #32800, ready for review.
The rewrite keeps grouped qualification ahead of dimension materialization and reuses the exact qualifying SUM. Native Q18 diagnostics retain one fact scan and normal parallelism, with 624 ORDERS rows and 623 CUSTOMER rows producing 624 dimension-join rows.
Local isolated comparisons against main cover all 22 queries at SF10 memory/disk and SF100 disk, using one process per configuration, an excluded cold suite and five warm suites. The disk condition retains MO’s 16 GiB shared cache and starts each query with zero OS residency for the task clone’s immutable data files. At SF100, Q18 wall time improves 24.23%, instructions 28.21%, and Go allocation bytes 40.19%; the observed Total improves 1.35%. Raw per-query medians, GC/timing variation and metric limits remain visible in the full comparison comment.
Focused/owning tests, normal SQL regression comparison, native-plan checks and the full default-mode pre-push static gate passed. Review, fresh CI and merge remain pending; this comment does not close the umbrella acceptance work.
perf(plan): reuse grouped sums after early key qualification (#32800)
XuPeng-SH commentedon Nov 16, 2026
The grouped-measure reuse implementation is merged into main via #32800 (merge
dd803f6072e5c778a38a4a12dc1b82d2a2d4f5a0, final PR head7e8238409a052d4d385559a98ff52bb229c402d8). Handing this subtask to @Ariznawlll for QA; this is not performance acceptance, umbrella closure, or a claim of 2x speedup.Author evidence reports one fact scan with early qualification (624 ORDERS / 623 CUSTOMER rows), focused/owning tests, public SQL comparisons and isolated SF10 memory/disk plus SF100 disk measurements. SF100 Q18 wall/instructions/Go allocation improved 24.23%/28.21%/40.19% in those captures. Latest approval reviewed
ecb269da91d23565a6a0ca4166ed31ffba4bddb1, not the final rebased head. Earlier coverage CI failures and subsequent queue/fork messages are not evidence of all-green final CI. No local tests or benchmark were rerun for this handoff.QA should verify aggregate-input equality, duplicate/nullable/missing dimension keys, changed filters, NULL/all-NULL values, decimal/HAVING/order/LIMIT boundaries, conservative fallback, early qualification and normal parallelism on current main. Retain the issue's full performance protocol and independently investigate Q6/Q17 slower signals: they remain inconclusive, not waived by Q18/Total gains. Existing captures have single-process/profile/counter-attribution and input/result-verification limits. No current confirmed counterexample or explicit unfinished code fix was found; remaining acceptance work stays open with QA.
Ariznawlll commentedon Nov 18, 2026
Note
QA 性能面补充验证:大数据量真机基准已实测(main
517e169538)。grouped-measure 复用的白盒可达性契约(TestGroupedMeasureSQLReachability)在本构建 PASS;真数据上 Q15/Q18 形态的详细触发窗口分析见下。保持 OPEN 至研发/负责人裁定。QA 补充:大数据量真机验证(#30857 grouped-measure 复用)
测试环境
main 隔离实例
517e169538(SQL 实测确认);lineitem5.5M 行 +orders1281M 行 +cust128150k 行 +partsupp800k +part200k,完全按 PR 白盒测试的三表比例(cust:orders = 1:6.7)。白盒(本构建)
TestGroupedMeasureReuseCarriesExactMeasurePASS、TestGroupedMeasureReuseRejectsDifferentBagsAndMultiplicityPASS、TestGroupedMeasureSQLReachabilityPASS——合并要求的"事实扫描退役"contract(facts==1)在此构建上由白盒证明可达。真数据计划形态分析(如实记录)
按白盒同款 Q18 形态在 5.5M 行真数据上复刻(qualification
sum>threshold+ 维度 join + 同度量外层投影):INNER(fact, SEMI(dim, qual-agg))的 join 序,SEMI 带 runtime filter 挂点(RuntimeFilterBuildList非空)——plainLogicalSemiJoin条件(要求空 runtime filter)在真机默认配置下不满足,复用未触发,计划保留 2 次事实扫描(该计划本身正确且带 runtime filter 加速)。set global runtime_filter_limit_in=1)后 join 序仍保持同形态。真数据计时(参考值,5.5M 行)
结论
Ariznawlll commentedon Nov 19, 2026
QA 功能修复验收通过:按 #30857 子任务关闭
本次裁定范围为 #32800 grouped-measure reuse 的功能修复、公开 SQL 路径及标准 TPC-H 多规模回归。结合本地真实计划/结果验证和标准 TPC-H 1G/10G/100G/1T nightly 证据,未发现该修复的正确性反例,按功能子任务以
COMPLETED关闭。1. 实际版本与修复交付
dd803f6072e5c778a38a4a12dc1b82d2a2d4f5a0。git_version()=035af99680,version()=8.0.30-MatrixOne-v1.3.0。87c44445f83e308ef12dd7ca0e570cec1e6690d9;已核对上述 perf(plan): reuse grouped sums after early key qualification #32800 merge 是其祖先。工作流仓库 SHA 未被当作引擎版本。2. 优化路径与结果验证(本地 main)
使用独立
qa_perf_q18_largeQ18-shaped 数据(customer=50,000、orders=1,000,000、lineitem=6,000,001;这是确定性合成数据,不冒充标准 TPC-H scale):dop=8;runtime_filter_limit_in=1对照也保持同一复用形态。inputRows=1,000,001、outputRows=9,901。EXCEPT均为 0;结果行数及 checksum 一致。grouped_measure_reuseSQL 用例及 focused planner tests 覆盖 NULL/all-NULL、缺失/重复维度、变更 filter 后的保守 fallback、Decimal、HAVING 和 ORDER/LIMIT 边界;本次关闭不是仅凭一条 SQL 执行成功或 mock 计划触发。3. 标准 TPC-H nightly 独立证据
mo-tpchrunner 固定为77081d5b3f24fec6e57b660427f0470ff73639ab,执行原始 Q18sum(l_quantity)>314资格子查询。error=0;同一规模重复输出逐字节一致。按 runner 的真实 comparator(行数、行序、列数、文本相等、数值误差不超过0.009)独立复核 pinned golden,四个规模的实际数值差均为 0。返回结果行数分别为 9、84、100、100。该 comparator 不是原始输入 checksum 或全部中间结果校验,以上仅按其实际语义陈述。
4. 性能证据边界与后续归属
本次 nightly 没有保存该 run 的 Q18 EXPLAIN/EXPLAIN ANALYZE,因此不把 nightly PASS 宣称为该 run 的单事实扫描证明;单事实扫描、early qualification 和并行度证据来自上述本地真实计划与 Analyze。
历史 gate 比较同 performance series 最近 5 次 PASS run 的 Q1–Q22 总耗时中位数,允许 25% 退化(1G 仅采集)。10G/100G/1T 当前总量均低于历史中位数,但这不是 #32800 修复前后同机 A/B,也不能据此宣称 Q18 的独立提升比例或 2x 收益。
因此,#30857 的功能子任务验收完成并关闭;父 issue #30838 仍保持 OPEN,继续承接同机修复前后 Q18/全查询配对性能、CPU/instructions、内存、I/O/spill 及此前 Q6/Q17 慢查询信号的完整性能预算验收。此处不把作者报告的性能数字当成本次独立复测结果,也不把 nightly 防退化 PASS 等同于全部性能验收完成。
本次仅完成 main 范围验证与功能子任务收尾,不外推到 4.2-dev/hotfix;未修改 MatrixOne 产品源码、旧公共 SQL 或 nightly 工作流。