You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
q1542_adv_not_exists_anti — NOT EXISTS anti-join shape.
Actual behavior
Both cases were stopped only after the runner limit:
Execution timeout after 7200s; skips remaining SQL in the current file and continues with the next file...
No CN OOMKilled, exit 137, Go panic, or fatal error was observed in the associated windows.
Expected behavior
EXISTS and NOT EXISTS execution plans over the AP dataset should complete within an operationally acceptable time. Two separate semi/anti-join shapes requiring more than two hours indicate an optimizer or execution performance problem.
Scope and related issues
This issue is limited to Semi/Anti Join execution.
Case sources: join_adv/j_batch_002.sql and join_adv/j_batch_028.sql
Regression coverage
After a fix, add bounded Jinpan/big-data regressions for representative EXISTS and NOT EXISTS query shapes, asserting completion and recording execution duration.
Reviewed against main@bcd5ed833b5400fe95f322e4028adb2bde3de0a4. The reported run used the diverged 4.2 dev build 4f62825d3, so its physical plans do not include all current-main optimizer changes.
q1542_adv_not_exists_anti: both correlations are direct same-domain equalities. Current main should expose hash keys and lower these filters to Hash ANTI joins, so the historical LoopJoin hotspot is likely addressed.
q1021_adv_srm_exists_attach: not closed by the merged rules. Its two positive EXISTS branches do not have identical outer key sets, so the OR-of-EXISTS UNION+SEMI rewrite is rejected. The predicates also contain CAST(bigint AS CHAR) and CASE; these are outside the current totality proof, so the MARK predicates may retain ISTRUE wrappers and the LoopJoin path.
This is code-path evidence, not a same-data latest-main execution result. Before closing, replay both cases on the same jinpan_001 data and record EXPLAIN ANALYZE: require Hash ANTI for q1542, no LoopJoin for q1021, bounded runtime, and correct results.
Jinpan AP verification update after #31585 (merged as 6d9f7127118de74a6831785ded85563d31b140a6):
q1021_adv_srm_exists_attach completed in 1.03 s and returned 500 rows in the optimized replay. It timed out after 1,800 s in the earlier run.
The replay used the pre-rebase candidate 2f114269a109aecb622c15be6bfd8814b3f76686; the merged revision has not yet been replayed on Jinpan. Each result is from a single execution on a different commit/environment, so this is not a controlled speedup measurement.
The replay verified completion and row count only; no golden-result comparison was performed. q1542_adv_not_exists_anti was not retested; perf: reuse full-partition windows and hash mixed EXISTS #31585 targets eligible positive EXISTS disjunctions and does not establish a fix for that NOT EXISTS query.
The issue remains open pending a merged-revision replay, result comparison, and verification of Q1542.
Activity
aptend commentedon Sep 7, 2026
Latest main code-path update (2026-09-07)
Reviewed against
main@bcd5ed833b5400fe95f322e4028adb2bde3de0a4. The reported run used the diverged 4.2 dev build4f62825d3, so its physical plans do not include all current-main optimizer changes.Relevant merged changes:
Expected impact by exact case:
q1542_adv_not_exists_anti: both correlations are direct same-domain equalities. Current main should expose hash keys and lower these filters to Hash ANTI joins, so the historical LoopJoin hotspot is likely addressed.q1021_adv_srm_exists_attach: not closed by the merged rules. Its two positive EXISTS branches do not have identical outer key sets, so the OR-of-EXISTS UNION+SEMI rewrite is rejected. The predicates also containCAST(bigint AS CHAR)andCASE; these are outside the current totality proof, so the MARK predicates may retainISTRUEwrappers and the LoopJoin path.This is code-path evidence, not a same-data latest-main execution result. Before closing, replay both cases on the same
jinpan_001data and recordEXPLAIN ANALYZE: require Hash ANTI for q1542, no LoopJoin for q1021, bounded runtime, and correct results.Ariznawlll commentedon Oct 28, 2026
结论
q1021 本轮仍在 1800 秒超时,测试不通过。 指定源码包含相关修复 PR,但该 SQL 形状未被当前安全改写覆盖,实际仍以 LoopJoin 条件扫描为主要热点。已转回 @aptend。
关键证据
main@861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f,TKE 部署复用镜像commit-861a2c4;未补取运行二进制完整 SHA。perf(plan): expose safe subquery predicates before join costing #27915、perf(plan): make outer and anti join planning fail-closed #27934、fix(plan): preserve TPCH Q19 hash key for widening CHAR casts #28048 均在指定 SHA 的祖先链上。nightly-regression-dis-tp-cn-682fq的 CPU profile:12:45–12:50 UTC,LoopJoin 子树占 94.32%;13:03–13:05 仍占 93.15%。热点为LoopJoin -> scanProbeMatches -> evalConditionWindow -> CASE/字符串求值,占比是对应 CN 采样窗口内的 CPU 比例。CAST(BIGINT AS CHAR)、CASE 也超出当前保守 totality 证明范围。SQL/schema/源码支持该分析,但缺少完整 EXPLAIN 和规则决策日志,尚不能逐个确认 MARK 节点及唯一拒绝条件。context canceled并回滚,取消响应有生效证据;不等于全部远端资源已同步清理。Pyroscope:process_cpu:cpu:nanoseconds:cpu:nanoseconds,service_name=mo-ap-regression-commit-861a2c4-20261027-40469797177/main,pod 与窗口如上。待解决点
Ariznawlll commentedon Oct 28, 2026
结论
测试不通过。补充与七条 inventory_ratio_win 超时查询对比后,q1021 的主要问题仍是混合外侧关联键的 OR-EXISTS 未被现有安全改写覆盖,运行时主要消耗在 LoopJoin 条件配对求值;与 #28109 普通整分区 SUM 重复 Fill 是两个不同的主要原因。 本轮 q1021 在 1800 秒客户端预算内未完成,主 statement 随后约 0.190 秒响应取消,不能将执行慢等同于取消失效。
“实际仍执行高成本 LoopJoin”由运行 profile 直接支持;“现有改写范围不覆盖此 SQL”由原 SQL、schema 和固定版本源码共同支持。尚无完整 EXPLAIN 和规则决策日志,不能声称逐个证明所有物理 MARK 节点或唯一拒绝分支。
关键证据
运行、SQL 与版本范围
mo-ap-regression-commit-861a2c4-20261027-40469797177。861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f;资产 SHA:3b53e658b0029b4f5c6615017fb48419b7743be8。commit-861a2c4。原环境消失前没有独立补取运行二进制完整 SHA,所以这里不把“指定版本包含 PR”提升为“运行二进制完整 SHA 已核验”。实际执行与 profile
q1021 于北京时间 2026-10-27 20:37:41.146 → 21:07:41.247 执行,触发 1800 秒客户端 timeout,没有有效成功结果。主 statement_id:
01a17d5d-cb4d-7b62-9fdc-9ee6132ffb93;协调 CN:nightly-regression-dis-tp-cn-682fq。Pyroscope datasource
pyroscope,profile typeprocess_cpu:cpu:nanoseconds:cpu:nanoseconds,selector:CPU 数值是对应协调 CN 和窗口内的样本子树并集,两层 LoopJoin 不重复相加;CPU秒可超过墙钟秒,不是单 SQL 墙钟时间占比。中段与末段都持续出现:
这是从 profile 取得的真实调用链片段,不是编造的 EXPLAIN。说明大量时间仍用于逐候选配对反复执行条件、CAST/CASE 与字符串向量构造,未整体转化成廉价的存在性哈希查找。七条 inventory 查询则集中在
processAggregateFuncRange -> sumAvgDecExec.Fill,详细逐条对比见:https://github.com/matrixorigin/matrixone/issues/28109#issuecomment-6460219468。为什么包含相关 PR 仍未覆盖 q1021
(contract_header_id, CASE(contract_type_code)),第二支只有contract_header_id。OR-of-EXISTS → UNION ALL + SEMI 的现有规则 要求各分支具有相同的确定性外侧等值键,逐一比较表达式和键数量。该 SQL 不满足这个安全适用范围,不能因为已有 OR-EXISTS 优化就认为它也被覆盖。ch.contract_header_id是 BIGINT,contract_type_code、m.table_name、m.table_pk_value为 TEXT。这里有CAST(BIGINT AS CHAR)和 CASE;它们不在当前保守的 totality 证明范围 内。insertMarkJoin 无法证明谓词 total/无副作用时会保留 ISTRUE 屏障,避免提前求值改变异常或 NULL 语义。取消路径有生效证据,性能问题仍在
客户端超时后,服务端于 UTC 13:07:41.437986(北京时间 21:07:41.437986)记录该主 statement 的 fail / context canceled,约晚 0.190 秒,随后有回滚记录。因此本轮未复现该主 statement 长时间不响应取消的症状;不能据此宣称所有远端 pipeline 和资源已同步释放。上一条窗口查询 q1020 的主 statement 也已在其超时后返回 context canceled,且此处 q1021 采样的主要热点为 LoopJoin,降低了把上一条窗口热点误归给 q1021 的风险。
待解决点
定向任务进度补充:首个 focused run40635348515 的 CN 完整 VCS SHA、Pod Ready、Proxy 三次探针均通过,但在导入 runner 的 Python cryptography/CFFI 依赖时失败,尚未执行 plan/业务 SQL。已仅修复测试客户端依赖隔离后复用同环境触发上述 run40635601332;产品与资产版本未变,最终 SQL 状态以该 run 的实际 case 证据为准。
Ariznawlll commentedon Oct 28, 2026
结论
测试不通过。本轮定向重测已结束,q1021原SQL再次1800秒超时;现在已补齐精确case耗时、同session计划/统计、取消退出确认和本轮CPU profile。 实际计划保留两层带ISTRUE的MARK Join,运行中LoopJoin子树占协调CN采样CPU 89.04%,与旧run的主要瓶颈相同,现有修复仍未覆盖这条混合关联键OR-EXISTS。
关键证据
本轮 focused run40635601332 / job122641727266 的 attempt1 已结束:重放步骤真实失败,job于北京时间 2026-10-28 14:34:55 收尾。失败原因是目标原SQL超时,不是plan/table_stats或客户端依赖失败。复用原namespace
mo-ap-regression-commit-861a2c4-20261028-40624634916,test_phase=focused, skip_load=true,没有重建或重新load。861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f;三个CN实际Govcs.revision均完整匹配,full_sha_verified=true。旧run运行二进制核验限制不追溯改变。05c69be7886efa6efb5136c395aa40b7dc5e7eb3;原SQL资产:3b53e658b0029b4f5c6615017fb48419b7743be8。runtime.json、execution/summary.json、每条original.sql、plan.jsonl、各表*.stats.jsonl、result.status.json和summary。以下精确耗时来自实际case文件,不是workflow步骤总耗时。SQL为 q1021_adv_srm_exists_attach / 固定batch002。artifact中的original.sql SHA256实际重算仍为
fb5aed0242c1f6ed53d91b2901731ee1ec0d471283d88c16b5c8b7eb5422dd42,未改写原SQL。三条重放的session均在node34616636-3462-3639-6336-633131353262,即CNnightly-regression-dis-tp-cn-s86d5;q1021 session01a180e4-ca66-78e8-bd38-28038d08fce9。本轮取消与退出证据
主statement
01a180e4-ca98-7f6e-b2a6-81648cb6a72b于北京时间 13:34:00.166921 记录fail/context canceled(Loki精确namespace,UTC05:33–05:36窗口),约晚于客户端结束 15.458ms。客户端超时后关闭自身连接,再只读SHOW FULL PROCESSLIST轮询该connection_id,最终client_query_exit_confirmed=true、abort_remaining=false;按脚本语义,该连接已不存在或处于Sleep,才继续下一条。没有执行KILL。这证明本轮主statement有界响应取消及客户端连接级退出检查通过,不证明全部远端资源已同步清理。失败记录rows=0不是成功返回空集,不能当作正确性结果。
实际计划和本次profile互相印证
(mark1 IS TRUE) OR (mark2 IS TRUE);MARK Join[9]有ID与CASE两键,MARK Join[13]仅有ID一键,ISTRUE屏障保留;没有合成单一UNION+SEMI。LIMIT500位于DISTINCT之上。pyroscope;profile typeprocess_cpu:cpu:nanoseconds:cpu:nanoseconds;先确认ProfileTypes/Series有数据,selector:百分比为该CN对应窗口的CPU样本子树并集,嵌套帧不重复累加,不是整条SQL墙钟时间占比。
同session table_stats(get/verbose,未refresh/patch)
初始与重放统计的这些关键值一致。sampling_ratio均1.0,关联字段null_cnt均0;NDV仍是估计,不能推导精确联合键基数。MARK内侧估计约116万行、外侧约3.25万行,存在昂贵配对条件的规模风险,不能将两侧乘积当实测比较次数。
该SQL不同分支的外侧键数/表达式不相同,加上BIGINT→CHAR及CASE,不满足当前 OR-of-EXISTS合并规则 与保守totality适用范围。有关PR已包含在固定版本,但“PR包含”不等于此SQL改写路径已覆盖;本次计划和profile给出了直接运行证据。
q1021 同session重放前完整 EXPLAIN VERBOSE(与初始计划逐行一致)
待解决点
perf: reuse full-partition windows and hash mixed EXISTS (#31585)
aptend commentedon Oct 29, 2026
Jinpan AP verification update after #31585 (merged as
6d9f7127118de74a6831785ded85563d31b140a6):q1021_adv_srm_exists_attachcompleted in 1.03 s and returned 500 rows in the optimized replay. It timed out after 1,800 s in the earlier run.2f114269a109aecb622c15be6bfd8814b3f76686; the merged revision has not yet been replayed on Jinpan. Each result is from a single execution on a different commit/environment, so this is not a controlled speedup measurement.q1542_adv_not_exists_antiwas not retested; perf: reuse full-partition windows and hash mixed EXISTS #31585 targets eligible positive EXISTS disjunctions and does not establish a fix for that NOT EXISTS query.The issue remains open pending a merged-revision replay, result comparison, and verification of Q1542.
Ariznawlll commentedon Nov 3, 2026
结论
测试通过。本次覆盖原 issue 的两条 Semi/Anti Join SQL 的大数据执行,以及本地真实数据抽样与 MySQL 的逐行对照;全量大数据未逐行与 MySQL 比对。
关键证据
main@650a4bb3a4666f22ddfd19d60783d17cb8d47675,3 CN / 1 TN:原 SQLq1021完成并返回 500 行、耗时 0.90 秒;q1542完成并返回 1000 行、耗时 18.87 秒。两条各运行一次,验证完成及行数,未对大数据结果做 golden 比较。main@d61a7206c16b30baa4efc525eb6067c4364035aa的本机二进制与 MySQL 8.0.45。逐表输入核对一致;采购、合同、附件关系和附件各 48 条真实关联记录,q1021返回 48 行;q1542返回 30 行。两条原 SQL 连续 3 轮全行一致。另有人工边界 fixture 与 DuckDB 对照,本地测试数据库及自建进程已清理。待解决点
payment_collection按原 AP 流程为空,非空情况由人工 fixture 覆盖。