Skip to content

[Performance]: FULLTEXT2 large-corpus search and index build lag behind Elasticsearch #30402

Closed

Description

@daviszhen
  • I have checked the existing issues.

Environment

  • Benchmark repository: matrixorigin/mo-benchmark
  • MatrixOne: FULLTEXT2; the reported BEIR artifacts use 8.0.30-MatrixOne-v1.3.0.
  • Elasticsearch: 8.17.0 for the MS MARCO, Rally, and BEIR comparison runs.
  • Self-hosted Linux runners: mainly mo-srv-129; the latest cancelled webis-touche2020 retry used mo-srv-128.
  • MatrixOne relevance configuration:
    • MS MARCO: a body FULLTEXT2 index, gojieba, POSITION_FREE=TRUE, BM25 bag-of-words mode, top-1000 retrieval.
    • BEIR: a title,body FULLTEXT2 index, gojieba, POSITION_FREE=TRUE, BM25 bag-of-words mode, top-1000 retrieval.
    • Official Rally PMC: a body FULLTEXT2 index through the MatrixOne Rally adapter.

Details of Performance

The end-to-end full-text benchmark shows a large MatrixOne performance gap on large corpora. The most relevant observations are below.

1. MS MARCO Passage Ranking Dev

Dataset size: 8,841,823 passages.

  • MatrixOne loaded all documents in 246.18 s and built the FULLTEXT2 index in 380.98 s.
  • MatrixOne completed 3,255 queries before the workflow was cancelled after 16,784 s. The persisted run file is valid, but no complete MatrixOne latency distribution was recorded.
  • The observed average phase time was about 5.16 s/query, including client processing, result-file writing, and connection wait; this is only a partial signal, not a formal latency metric.
  • Elasticsearch completed all 55,578 scored queries with 8.88 QPS, p50 99.14 ms, p95 218.27 ms, and p99 328.56 ms.
  • On the same 3,255 completed queries, MatrixOne was lower than Elasticsearch by 5.98% NDCG@10, 6.57% MRR@10, 0.51% Recall@100, 6.38% MAP@100, and 4.32% P@10.
  • The MatrixOne run also logged Lost connection to MySQL server during query before cancellation.

Evidence: MatrixOne run 38237125057, Elasticsearch run 38220840678.

2. Official Rally PMC

Dataset size: 574,199 documents, one client, official append-no-conflicts challenge and official-full schedule.

  • MatrixOne loaded the corpus in 7,612.92 s and built the FULLTEXT2 index in 2,249.23 s. It became queryable after about 9,862 s.
  • Elasticsearch became queryable after about 553.5 s. MatrixOne was therefore about 17.8x slower to reach the query phase under the tested configurations.
  • For default, Elasticsearch p50 was 10.86 ms versus MatrixOne 867.61 ms, about 80x slower.
  • For term, Elasticsearch p50 was 10.89 ms versus MatrixOne 59.26 s, about 5,400x slower.
  • MatrixOne completed only the default workload and 131 term requests before the workflow was cancelled after more than six hours. The remaining phrase, aggregation, and scroll workloads did not complete.
  • Elasticsearch completed the full challenge with 0% errors.

The load settings were not identical: MatrixOne used 40 MySQL connections with batch size 2,000, while Elasticsearch used one Rally bulk client with batch size 500. The time-to-query and query-latency gap is still large, but the load comparison needs a paired run before drawing a strict ingestion conclusion.

Evidence: MatrixOne Rally run 38131204919, Elasticsearch Rally run 38196188713.

3. BEIR

Elasticsearch completed all 13 datasets. MatrixOne completed 10 datasets; fever and hotpotqa produced only partial query runs, and webis-touche2020 did not finish FULLTEXT2 index creation.

Across the 10 datasets completed by both engines:

Metric MatrixOne Elasticsearch Difference
Load time average 56.06 s 158.46 s MatrixOne faster in this workload
Index time average 75.09 s 0.81 s Stage definitions are different; MatrixOne builds FULLTEXT2 after load
Query P95 average 1,732.37 ms 84.03 ms MatrixOne about 20.6x slower
NDCG@10 average 0.3638 0.4173 -0.0536
MRR@10 average 0.4321 0.4931 -0.0610
Recall@100 average 0.5424 0.5766 -0.0342
MAP@100 average 0.2594 0.2989 -0.0396

The largest query-latency gaps were observed on large datasets:

  • dbpedia-entity: MatrixOne 5.33 s vs Elasticsearch 72.37 ms, about 74x slower.
  • nq: MatrixOne 2.83 s vs Elasticsearch 69.75 ms, about 41x slower.
  • climate-fever: MatrixOne 8.37 s vs Elasticsearch 325.10 ms, about 26x slower.
  • quora: MatrixOne 379.66 ms vs Elasticsearch 52.90 ms, about 7x slower.

fever ran for about six hours and left 4,026 complete top-1000 query results. hotpotqa left 4,178 complete top-1000 query results and exited with code 137. webis-touche2020 ran for about six hours during index creation without starting the query phase.

Evidence: Elasticsearch BEIR run 38373740358, MatrixOne BEIR run 38386969786, latest webis-touche2020 retry on srv128.

Initial analysis

  1. MatrixOne creates the FULLTEXT2 index in a separate CREATE FULLTEXT2 INDEX phase after loading the table. Elasticsearch builds Lucene inverted structures during bulk ingestion and refresh/merge. The reported index-stage numbers are therefore not directly equivalent, although MatrixOne's time-to-query is still much higher in the Rally run.
  2. The MatrixOne query path evaluates MATCH(...) through SQL, computes BM25 scores, orders by relevance, applies a deterministic document-id tie-breaker, and returns the top 1,000 rows. The large-corpus latency pattern suggests that candidate posting traversal, BM25 scoring, top-k ranking/sorting, row lookup, or the SQL/MySQL protocol path needs profiling.
  3. The Rally term workload shows a severe long-tail regression: completed MatrixOne requests were around one minute at p50 while Elasticsearch requests were around 11 ms. This path should be isolated with a small fixed query set and CPU/heap profiles.
  4. Long workloads are not yet robust: the benchmark has seen manual cancellation, a MySQL connection loss during MS MARCO, exit code 137 during BEIR hotpotqa, and an index build that did not finish within about six hours for webis-touche2020.
  5. Retrieval quality is also lower in the current comparison. MatrixOne uses gojieba position-free BM25 bag-of-words, while Elasticsearch uses its english analyzer and Lucene BM25. The quality gap should be separated from the engine-performance gap with a shared token stream and paired BM25 settings.
  6. The runs are useful production signals, but the hosts, MatrixOne revisions, load parameters, and phase-timing semantics are not completely identical. A strict A/B run on the same host and resource limits is still needed.

Requested investigation

  • Profile FULLTEXT2 search on the MS MARCO, PMC term, and large BEIR workloads, including posting-list traversal, term metadata decoding, BM25 scoring, candidate materialization, top-k selection/sorting, row lookup, and MySQL protocol time.
  • Add an explain/trace or benchmark counters that show candidate counts and time spent in each stage of a MATCH/BM25 query.
  • Investigate why the query path degrades from millisecond latency on Elasticsearch to seconds or minutes on MatrixOne as corpus size grows.
  • Investigate FULLTEXT2 index-build scalability and whether index construction can be parallelized or made incrementally queryable.
  • Investigate connection/resource behavior during long-running queries so cancellation, timeout, memory pressure, or process termination does not leave partial runs without a clear server-side diagnostic.
  • Re-run a paired A/B benchmark on the same host, MatrixOne revision, CPU/memory limits, parser, BM25 parameters, query concurrency, and top-k protocol.

Related FULLTEXT2 optimization issues include #29205 and #27250. This issue adds end-to-end evidence from MS MARCO, official Rally, and BEIR and tracks the cross-workload performance gap.

Additional information

Detailed local reports with the raw artifact manifest and partial-query analysis:

  • BEIR-MatrixOne-Elasticsearch-Test-Report.md
  • official-msmarco-partial-matrixone-elasticsearch-report.md
  • official-rally-pmc-test-report.md

Activity

  1. added
    severity/s0
    on Oct 16, 2026
  2. XuPeng-SH commented on Oct 22, 2026

    @XuPeng-SH
    Contributor

    Current-head validation blockers — PR #30618

    The exact-head review at 8e0942465fa277a8e444357c242cdcae4c6cd309 reports the following actionable correctness/compatibility findings (the cited probes are from that review; this automation has not independently rerun them):

    1. P1 — capability collision. This branch assigns MORPC 128 to FULLTEXT2 token-filter support, while current main uses 128 for JSON/numeric comparison semantics. The analyzer gate accepts a cluster minimum of 128, so a main-128 CN can be treated as token-filter capable even though its ISCP writer does not strip stopwords. CDC can then write postings inconsistent with the filtered index/query semantics. Preserve the current-main 128 meaning and allocate a distinct capability.
    2. P1 — score-only LIMIT pushdown drops SQL tie-break winners. For ORDER BY score DESC, id DESC LIMIT 1, equal-score candidates may be truncated before the secondary ordering; the outer sort cannot recover the discarded row. The review reports a probe where ID 2 is the required winner but ID 1 survives the pushed limit.
    3. P2 — stale INCLUDE recheck after top-k truncation. A candidate can consume the pushed top-k before the restored base-table predicate rejects it, hiding the next eligible row. The review reports a focused production-search probe for this ordering.

    The review is already recorded on PR #30618; this issue comment links those blockers to the existing open tracking issue. No new issue is being opened. Evidence is reviewer-reported, not independently reproduced by this automation; the local workspace lacks Go and an exact-head checkout.

  3. XuPeng-SH commented on Oct 22, 2026

    @XuPeng-SH
    Contributor

    Re-review on current head 96a44817656fa5b205fdcfbb46b87ec74f24065f — score-tie LIMIT blocker remains

    The capability collision reported on the previous head appears fixed: this diff now allocates MORPCVersion129, distinct from main's JSON/numeric 128.

    The P1 SQL-ordering issue is still present by static inspection of the current head. Both coveredFulltext2ScoreLimit and pushJoinFulltext2ScoreLimitFromSort accept any ORDER BY with a leading score DESC key and push only LIMIT+OFFSET into the search; the new fulltext2_candidate_limit.sql even asserts a CandidateLimit for ORDER BY score DESC, id LIMIT 2. If multiple rows tie at the cutoff, the index search may retain an arbitrary subset, then the outer secondary key cannot recover the SQL-required winner. Please decline pushdown when secondary order keys exist, or make the search preserve every score tie at the cutoff. Add a regression with equal scores straddling the LIMIT boundary for both covered and non-covered join plans.

    This is source-level review of exact head 96a4481; I could not run the SQL test locally (no MatrixOne checkout/Go runtime). The prior review's runtime evidence is not represented here as my own execution.

  4. XuPeng-SH commented on Oct 23, 2026

    @XuPeng-SH
    Contributor

    PR #30618 follow-up — current head d317d0d6cc567eb63ceaa77db57515dc2209fa7c (2026-10-23)

    XuPeng-SH's latest submitted review on this head still identifies the two LIMIT-pushdown correctness blockers already tracked here: (1) score-only candidate truncation can discard the required row for ORDER BY score DESC, id DESC LIMIT 1; (2) a non-covered INCLUDE-filter query can truncate before the restored current-value recheck and return too few rows. The review says the relevant implementation is unchanged from its earlier probe head 96a44817656fa5b205fdcfbb46b87ec74f24065f; its retained probes/reports are reviewer evidence, not a fresh independent execution by this automation.

    This is a head/evidence refresh of the existing findings, not a new issue. The issue remains open pending a code fix and validation. This workspace has neither a MatrixOne checkout nor Go, so I could not run the exact-head tests.

  5. XuPeng-SH commented on Oct 23, 2026

    @XuPeng-SH
    Contributor

    PR #30618 head update — d5adc1464f8eeb309155773e2061b6d2cb185e80 (2026-10-23)

    Static review of the one-commit delta shows the P1 secondary-ordering issue is addressed: both covered and base-join LIMIT pushdown now require exactly one ORDER BY key, and the new BVT covers equal-score rows at the cutoff, ASC/DESC tie-breaks, OFFSET, plus the bounded derived-table case. The latest formal review is still against d317d0d; I did not independently run the new tests.

    The P2 short-result case remains by design: on the non-covered path, stale/index-time candidates can take bounded slots before the base-table INCLUDE recheck. The new design doc explicitly accepts this while index freshness is unresolved and links the existing open follow-up #30853. This PR extends that known behavior to its new explicit score-only LIMIT path. Please keep #30853 as the owner of the freshness fix; no duplicate issue is needed.

  6. cpegeric commented on Nov 10, 2026

    @cpegeric
    Contributor

    please verify and close

  7. Ariznawlll commented on Nov 16, 2026

    @Ariznawlll
    Collaborator

    测试版本

    原问题验证

    针对修复交接中的 FULLTEXT2 candidate LIMIT 正确性阻断项完成验收:

    1. 六行相同 BM25 分数时,ORDER BY score DESC, id DESC LIMIT 1 返回真正的 tie-break 胜者 id=6,而不是被提前截断的任意行。
    2. 相同数据使用 id ASC 时返回 id=1,两个方向均正确。
    3. INCLUDE keep 过滤会排除 id=1;pushed top-k 不会先让无效候选挤占名额,最终 LIMIT 2 返回 3、2。
    4. 等分数据 LIMIT 2 OFFSET 1 返回 5、4,OFFSET 作用于完整二级排序结果。

    Happy Path 覆盖

    覆盖 covered INCLUDE 查询、score 加 PK 的双键排序、LIMIT/OFFSET 及重复执行;候选下推后结果保持稳定,FULLTEXT2 索引 force_sync 后执行确定性断言。

    Unhappy Path 覆盖

    重点覆盖等分 cutoff 和被 INCLUDE 条件淘汰的候选行,这两类场景可发现“先截断、后过滤/排序”造成的少行或错行;本次均未出现。

    白盒验证

    #30618 引入并行 segment search 与 score-LIMIT 等下推路径;#31487 将 ORDER BY score DESC, pk LIMIT 纳入与 score-only 相同的安全 bound 处理。验证结果与维护者“please verify and close”的当前交接范围一致。

    回归测试

    已追加 matrixorigin/motr#349:14_issue_regression/issue_30402_fulltext2_candidate_limit(5 项场景断言)。普通 diff 模式 3 并发连续两轮通过;PR 4 项 CI 全部成功。用例标记 @target-branch: main。

    验证边界

    本次关闭依据为已交接 pushdown 正确性修复的验收,不声称本地小夹具消除了 BEIR/MS MARCO 大语料下与 Elasticsearch 的全部性能差距;未重复完整 BEIR、MS MARCO 或 Rally 基准。

    测试结论

    在修复交接范围内测试通过。

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

Metadata

Metadata

Assignees

Labels

kind/performanceseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions