Repository navigation
Description
Parent issue
This is a sub-issue of #27665: significant gap in ClickBench query performance between MatrixOne and DuckDB.
Summary
ClickBench Q14 shows a significant MatrixOne performance gap against the DuckDB reference. The values below are elapsed seconds. Each result array is the three measurements emitted by the adapter: [run 1, run 2, run 3]; warm median is the median of the available run-2/run-3 values.
Query
SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10;Performance comparison
| Engine | Run 1 | Run 2 | Run 3 | Warm median |
|---|---|---|---|---|
| MatrixOne | 14.820 | 11.310 | 11.090 | 11.200 |
| DuckDB | 3.273 | 0.595 | 0.623 | 0.609 |
- MatrixOne / DuckDB warm-median ratio: 18.39x
- Warm-median difference: 10.591 seconds
- Raw MatrixOne timing array:
[14.820, 11.310, 11.090] - Raw DuckDB timing array:
[3.273, 0.595, 0.623]
Environment and data
MatrixOne measurement:
- Branch:
main - Commit:
249a458ba567b26d1818fb0496b449135cb05ef2 - Hardware:
server 129 - OS: CentOS
- Dataset: ClickBench
hits, 99,997,497 rows - MatrixOne raw output:
/mnt/fastdata/ClickBench/matrixone/raw_results.md
DuckDB reference:
- Result file:
duckdb/results/20260511/c6a.metal.json - Machine label:
c6a.metal - Result date:
2026-05-11
The two measurements were not collected on the same hardware. The DuckDB value is the latest local c6a.metal reference available; an apples-to-apples rerun on the same server is recommended before assigning a final performance regression magnitude.
Steps to reproduce
- Follow the reproduction steps in #27665, including the MatrixOne and DuckDB adapter READMEs:
- Use the same
hits.tsv.gzdataset for both engines (the adapters support loading the gzip file directly). - In the MatrixOne adapter, run
./benchmark.shafter settingMATRIXONE_HOME,MATRIXONE_DATA_FILE,MATRIXONE_HOST,MATRIXONE_PORT,MATRIXONE_USER, andMATRIXONE_PASSWORDas described in [Bug]: significant gap in clickbench query performance between matrixone and duckdb #27665. - In the DuckDB adapter, run
./benchmark.shafter settingDUCKDB_BIN_PATH,DUCKDB_DB_PATH, andDUCKDB_DATA_PATHas described in the README. - Compare the Q14 entry in
queries.sql; run the query three times after loading the data and record elapsed time and whether the query completes successfully.
Notes
- The timing gap is the subject of this sub-issue; query-result correctness should be verified independently.
Expected behavior
On comparable hardware with the same dataset, MatrixOne should not exhibit a large query-level performance gap for this workload. Please investigate the execution plan, operators, memory use, and any spill or connection/timeout behavior relevant to this query.
Activity
XuPeng-SH commentedon Sep 1, 2026
2026-09-01 candidate diagnosis
SQL shape: filtered high-cardinality SearchPhrase groups, exact COUNT(DISTINCT UserID) inside each group, then Top10.
Likely cost boundary: this combines variable-width group ownership with exact (SearchPhrase, UserID) pair deduplication. The winning topology depends on phrase NDV/skew and per-group UserID duplicate ratio; TopN is downstream and cheap.
Current-main status: #27693 and #27790 changed DISTINCT planning after the baseline; #27744/#27758 changed string ownership and statistics visibility. Rebaseline before selecting more work.
Next action: profile group-owner balance, local pair survivor ratio, exchanged pair bytes, exact-state memory/spill, MergeGroup/finalization CPU, and hash-key bytes. If many balanced phrase groups exist, keep group ownership; if few/hot groups dominate, #27720 canonical-pair partitioning is the candidate. #27753 applies only where the carried hash matches the complete consuming equality identity.
Controls: phrase skew, UserID duplicates, NULL/empty strings, long keys, DOP/topology, and forced spill.
XuPeng-SH commentedon Oct 24, 2026
Tracking consolidated into #27665. The canonical issue now includes this report's independent scope and acceptance criteria. This is administrative consolidation, not a claim that the defect is fixed; the original reproduction and discussion are preserved here.