Skip to content

[Bug]: significant gap in clickbench query performance between matrixone and duckdb #27665

Open
13 of 17 issues completed

Description

@daviszhen

Proposed consolidated tracking scope: ClickBench 同批基准性能差距

These are independent reproductions grouped under one acceptance contract; a common immediate root cause is not assumed. Administrative consolidation does not claim that any defect is fixed. Original report bodies and discussions remain available at the links below.

Included reports

  • #27669 — [Bug]: ClickBench Q05 is significantly slower in MatrixOne than DuckDB
  • #27671 — [Bug]: ClickBench Q09 is significantly slower in MatrixOne than DuckDB
  • #27673 — [Bug]: ClickBench Q13 is significantly slower in MatrixOne than DuckDB
  • #27674 — [Bug]: ClickBench Q14 is significantly slower in MatrixOne than DuckDB
  • #27675 — [Bug]: ClickBench Q15 is significantly slower in MatrixOne than DuckDB
  • #27676 — [Bug]: ClickBench Q16 is significantly slower in MatrixOne than DuckDB
  • #27677 — [Bug]: ClickBench Q17 is significantly slower in MatrixOne than DuckDB
  • #27678 — [Bug]: ClickBench Q18 is significantly slower in MatrixOne than DuckDB
  • #27680 — [Bug]: ClickBench Q24 is significantly slower in MatrixOne than DuckDB
  • #27681 — [Bug]: ClickBench Q29 is significantly slower in MatrixOne than DuckDB
  • #27683 — [Bug]: ClickBench Q33 is significantly slower in MatrixOne than DuckDB
  • #27684 — [Bug]: ClickBench Q34 is significantly slower in MatrixOne than DuckDB

Acceptance checklist

  • Keep every query, SQL text, original timing, measurement environment and existing diagnosis as a separate checklist entry.
  • Rebaseline on the same hardware and current main; historical ratios are not current regression measurements.
  • Do not mark the tracker complete until every listed query is resolved, explicitly accepted, or split into owned work.

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

249a458

Other Environment Information

- Hardware parameters: server 129
- OS type:centos
- Others:

Actual Behavior

matrixone 的query 和 ddl 与 mysql的一致.

Image

Expected Behavior

there is no significant gap

Steps to Reproduce

看readme

https://github.com/matrixorigin/mo-benchmark/blob/main/clickbench/matrixone/README.md#run-in-129

https://github.com/matrixorigin/mo-benchmark/blob/main/clickbench/duckdb/README.md#%E8%BF%90%E8%A1%8C%E5%AE%8C%E6%95%B4-clickbench

Additional information

No response

Sub-issues

Sub-issues

13 of 17 Issues completed
Loading 17 sub-issues

Activity

  1. added
    kind/bug
    on Aug 26, 2026
  2. changed the title [-][Bug]: significant gap in clickbench query performance between matrixon and duckdb[/-] [+][Bug]: significant gap in clickbench query performance between matrixone and duckdb[/+] on Aug 26, 2026
  3. XuPeng-SH commented on Sep 1, 2026

    @XuPeng-SH
    Contributor

    2026-09-01 SQL-shape / ROI update

    The published numbers are a useful opportunity map, but not a current-main ranking: MatrixOne was measured at 249a458 on server 129, while DuckDB was measured on c6a.metal. Current main also contains changes merged after that baseline: #27693 (Q10 mixed DISTINCT), #27790 (single/few-group exact DISTINCT), #27744 (complete VARCHAR shuffle ownership), and #27758 (synchronous ANALYZE statistics publication). Rebaseline on one host before claiming a remaining ratio.

    Current engineering-ROI ranking from the SQL and current implementation:

    1. Remove proven constant GROUP BY expressions from the physical hash key (Q35). Keep the logical output, but hash URL rather than (constant 1, URL). Small, general planner/executor-hint change; Q35 versus Q34 suggests a meaningful avoidable cost.
    2. Safe affine multi-aggregate reduction / shared aggregate-argument evaluation (Q30). Replace eligible families such as SUM(x+c_i) with a minimal shared state and final expressions; fail closed for NULL/type/overflow/decimal/float boundaries.
    3. One-pass REGEXP_REPLACE for pos=1, occurrence=0 (Q29), after closing the recorded correctness discrepancy. The current implementation finds all match indexes and then runs ReplaceAll, traversing the regexp twice.
    4. Cost-gated canonical grouping-hash reuse ([Enhancement]: Reuse canonical grouping hashes across shuffle and aggregation #27753) plus compact composite-key handling (Q13-Q19, Q29, Q34-Q35). Broadest affected family, but a larger protocol/ownership design.
    5. Exact bounded state for unordered GROUP BY ... LIMIT K (Q18). A deterministic global key/hash rank can bound retained groups while still scanning all rows; distributed partial/merge completeness must be proven.

    Runner-up: extend existing filter late materialization through local/global TopN for Q24 so wide SELECT * payload is fetched for final candidates rather than every filter survivor.

    Per-query comments below record the SQL shape, candidate problem, landed work, and next validation/optimization action. “Candidate” is intentional: operator profiles on current main are required before assigning a root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions