Repository navigation
Description
Description
TPC-DS 1T Q4 did not finish within 1,200 seconds in two independent runs on the same official main commit. EXPLAIN shows the year_total CTE expanded into repeated sales-table scans, aggregations, and joins. This is a performance investigation request: the repeated scans may contribute to the long runtime, but operator timings and the root cause are not yet established.
Environment
- MatrixOne official
main:7fcd9bdff8433d72983f0399fd5c10dcab91a00a; single hostmo-srv-129, 64-core plan. - Freshly imported TPC-DS 1T database; source and database row counts were checked for all 25 tables.
processLimitationSize=42949672960(40 GiB); serviceMemoryMax=180 GiB, swap disabled; TN auto-merge disabled and verified for the diagnostic run.- Diagnostic session settings
join_spill_mem,agg_spill_mem,sort_spill_mem,max_dop:0, 0, 0, 0. Disk safety floor: 200 GiB.
Steps to reproduce
- Load TPC-DS 1T data into
tpcds_1t, using the above configuration. - Run the original
/data4/weilu/tpcds/query_1t_mo/query4.sqlagainsttpcds_1twith a 1,200-second client timeout. The exact SQL and output are in the linked artifacts; Q4 SQL SHA-256:b4804b6da5f5d4a2c809041d961df64021155eaca9fa723740cd0c080a6fccb5. - Compare with Q3 on the same database and inspect the Q4
EXPLAINplan.
Actual behavior
- Q4 returned no rows before the client timeout in both runs: exit status
124, 1,200 seconds, 0 output lines. The client timeout is an external test limit; these runs do not prove the query would never complete. - In the diagnostic plan,
store_sales,catalog_sales, andweb_saleseach appear in sixTable Scannodes, andcustomerappears in 18. The plan also contains repeated aggregations and joins. These are plan-node counts, not measured physical scan counts. - In the fourth process sample, the MO process showed cumulative average CPU of 5,685% and RSS of 13,578,660 KiB. Q4 was still present in the process list. Earlier samples showed RSS around 17.4 GiB.
- The captured service logs did not show the original
hash build memory budget exceedederror or an OOM error. In the diagnostic run the lowest sampled/data3available space was 346,915,270,656 bytes (about 323 GiB), above the protection floor.
Expected behavior
Q4 should complete within a reasonable and documented performance envelope on the 1T dataset. Please review the repeated CTE expansion and identify the actual runtime bottleneck; an authoritative Q4 baseline or SLO is not yet available for this environment.
Stability and controls
- Reproducer: 2/2 exceeded 1,200 seconds on the same main commit; the runs used the same 1T database and configuration. An earlier run on another commit exceeded 600 seconds.
- Control: Q3 returned successfully in 6 seconds in both 1,200-second Q4 runs.
- The independent correctness of query results was not assessed. Four attempted goroutine stack captures produced empty files, so the slow operator and whether forward progress continues are not established.
- The dedicated MO service was stopped after timeout (
ActiveState=inactive,Result=success), and the workflow log confirms its owned drain was released.
Evidence
- First 1,200-second run: https://github.com/matrixorigin/mo-auto-test/actions/runs/43827229610 ; logs, SQL, disk samples.
- Diagnostic run: https://github.com/matrixorigin/mo-auto-test/actions/runs/43831562163 ; EXPLAIN, SQL, process samples, service logs and cleanup.
- Original 40 GiB HashBuild budget issue: [Bug]: TPC-DS 1TB Q64 exhausts HashBuild budget instead of spilling #26742; historical Q4 error-propagation issue: [Bug]: TPC-DS 1TB Q4 returns context canceled instead of the HashBuild failure #26745. The present timeout has not been shown to have the same cause.
Code analysis
No confirmed code-level cause yet. Repeated year_total expansion in EXPLAIN is an investigation lead, not proof of causation. Please examine CTE reuse, operator runtime profiles, and a comparable Q4 baseline.
Regression coverage
After diagnosis and fix, add a TPC-DS 1T performance regression check with an agreed time envelope and relevant plan/operator metrics; independently validate query results.
Activity
fix(plan): avoid premature cross joins and correct semi-join coverage (…
XuPeng-SH commentedon Nov 17, 2026
转 QA 验证(不是验收通过,也不关闭本 issue)。
关联修复:#32833 已于 2026-11-17 合入 main,merge SHA
7fc45a2be2424d887199c5949362855cbacfe30f(PR heada19258fbe50a25e15b774525df49559048b79fc0)。修复多输入谓词尚不可用时过早选择笛卡尔连接,并修正 SEMI 匹配覆盖率估计;未修改执行器、spill 或预算,也不是 CTE 物化/复用实现。已公开的验证证据及边界:
8e8708a8d3加对应补丁,不是最终合并 SHA 的复测。37a72bd205867cac56506c09cba2e44b3ef9db52上报告 7 项 focused planner tests、完整 planner suite(47.438 s)、EXPLAIN consumer、go vet 与 fresh native build 通过;精确 merge-base 负对照命中预期缺陷。评审明确未独立重跑作者的 1T 性能、fixture 对比与 111 包静态检查,且未取得这些项目的原始 receipts。socket hang up,未产生 UT report,不能称为 UT 通过,也不是已验证的查询反例。本次交接没有自行运行测试。请 QA 在最终 main 上优先复跑本 issue 的原始 Q4 SQL(含记录的 SHA-256)、1T 数据及原 40 GiB / 自动 spill 配置,保留完整结果、耗时、operator profile、内存/磁盘与超时清理证据,并独立验证结果正确性;与同环境基线比较并明确性能 envelope。兼顾多输入/volatile 谓词、未知 tag/list 依赖、不可避免的 cross join,以及 SEMI 唯一/非唯一 key、空输入和物理换边;回归 Q35 和其他 TPC-DS/TPC-H 查询。未测范围由 QA 补齐,不把历史重复 CTE plan 节点数直接当作物理扫描次数或已证实根因。
已读完 issue 与 PR 的现有完整评论,未发现适用的当前已验证反例或明确未完成的开发 follow-up。按持续交接流程改派唯一 @Ariznawlll;若原环境复测出现反例,请携带具体 SHA、配置与证据回转开发。
Ariznawlll commentedon Nov 18, 2026
QA 阶段性验证(planner 层)+ 回归交付;1T 性能 envelope 待远端环境复测,issue 保持 OPEN。
已验证(最终 main
517e1695388cbaf1135238d5ab0c19a4556fb551)query4.sql,SHA-256 校验b4804b6da5f5d4a2c809041d961df64021155eaca9fa723740cd0c080a6fccb5与正文记录一致。pkg/sql/plan包测试(35.3s,最终 main):ok,无回归。回归交付
14_issue_regression.issue_32806_q4_plan_no_cartesian(EXPLAIN 形态 4 断言:计划生成 / INNER 存在性 / 零无条件笛卡尔 / 空集执行),record 2/2 + verify 2/2 PASS,已入今日 main PR https://github.com/matrixorigin/motr/pull/358(commit 627d1e5)。未覆盖(遵守正文边界,不算验收)
下一步(需要):远端 1T 环境的一次完整复跑(含修复 SHA 与 operator profile),QA 即可给出最终 envelope 结论。
Ariznawlll commentedon Nov 18, 2026
结论
测试通过。129 上使用修复后的 main 复测 TPC-DS 1T 原始 Q4,95.107 秒正常完成,未复现原先 1,200 秒超时。
关键证据
87c44445f83e308ef12dd7ca0e570cec1e6690d9,包含修复 #32833;2026-11-18 在 129 单机验证。b4804b6da5f5d4a2c809041d961df64021155eaca9fa723740cd0c080a6fccb5。执行退出码 0,客户端耗时 94.260 秒、总耗时 95.107 秒;返回 100 行,输出 SHA-256 为6017713acffe4e96b1d125969e4e09f33a663eb7b41ea1c91d67aefdb082b0cd,与 11 月 12 日保存的 MatrixOne 成功输出逐字节一致。Q3 对照正常完成,总耗时 7.302 秒。/data3/codex-tpcds-sorted-1t-lab/catalog-reuse-20261118-87c44445/baseline-r3/,其中summary.tsv、output-comparison.tsv和results/query4/可供核查。待解决点
agg_spill_mem=4 GiB、sort_spill_mem=512 MiB、join_spill_mem=0,服务MemoryMax=192 GiB;与原报告的全自动 spill、180 GiB 服务内存配置不同,40 GiB process limit 尚未核实。输出已与历史 MO 结果对照,尚未完成独立引擎结果对照。