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
{{ message }}
Repository navigation
[Performance]: defer FULLTEXT2 phrase position decoding until document alignment #27155
FULLTEXT2 positional phrase search currently decodes a posting block's position payload while cursors are still advancing and aligning document ordinals. For sparse phrase intersections, many decoded position blocks are never inspected because the terms do not align on a common document.
Profiles from the 2,303,643-document gojieba workload show phraseCursor.skipTo, position decoding, and varint decoding as the dominant Natural Language Mode costs.
Proposed scope
Split phrase-cursor document-block state from position-block state.
Let doc() and skipTo() decode only document ordinals.
Decode positions only after all phrase cursors align on a common document and positions() is requested.
Decode each position block at most once per cursor/block.
Preserve the existing phrase membership, BM25/TF-IDF score, result ordering contract, buffer ownership, and serialized index format.
Non-goals
No SQL, DDL, FST, posting, CDC, or runtime-filter format changes.
No changes to Boolean, BM25 OR, prefix, or position-free routing.
No new cache or background state.
Acceptance criteria
Differential phrase tests match the existing fallback for build-side and serialized loaded segments, including sparse intersections and block boundaries.
Document-only cursor advancement does not decode positions.
FULLTEXT2 package tests, focused race tests, build, vet, and the relevant FULLTEXT2 BVT control pass on the PR head.
A same-data A/B shows lower CPU/request or higher Natural Language Mode QPS without a Boolean control regression.
QA decision
QA required: yes
Reason: the optimization is internal and semantics-preserving, but the performance claim depends on a deployed real-data workload.
Production entrypoint: positional FULLTEXT2 MATCH ... AGAINST (... IN NATURAL LANGUAGE MODE).
Automated terminal coverage: differential PK membership and float32 score-bit tests.
Remaining validation: representative latest-main A/B on the 2,303,643-document workload.
Current main: b5900c275d0cad01f499357f6d3830cd71fa17e4
Automated evidence: CHECK PR VALID, shared build, UT coverage, and Summary completed successfully; complementary BVT planning also passed. The PR's correctness preflight covered 82 differential queries with identical PK membership and float32 score bits, and the paired 2.3M-document benchmark completed all 10 cells with zero errors/timeouts, but was marked PERF_INCONCLUSIVE_HOST_BUSY because the host was shared.
QA required: yes. Remaining testing scope is the production positional FULLTEXT2 entry point (MATCH ... AGAINST (... IN NATURAL LANGUAGE MODE)) on current main: verify deferred phrase-position decoding for sparse and dense phrase intersections, single-slot/prefix fallback, WAND parity, result/score equivalence, and representative latency/throughput against the baseline. Expected PASS: identical result PK membership and float32 score bits, no errors/timeouts, and the intended sparse-intersection improvement without regression in the boolean MUST control. Expected FAIL: any correctness/score mismatch, timeout/error, or material regression in the covered control.
Issue author is VioletQwQ-0 (not heni02), so the designated tester is Ariznawlll.
Activity
perf(fulltext2): decode phrase positions after doc alignment (#27165)
VioletQwQ-0 commentedon Aug 17, 2026
Transfer to testing after #27165 merged.
b66120c91839aa2ec53f2a71cc0d025eb06894f2ec591dc9d4ec6b3beb81b804dac11aceb9b66441main:b5900c275d0cad01f499357f6d3830cd71fa17e4CHECK PR VALID, shared build, UT coverage, andSummarycompleted successfully; complementary BVT planning also passed. The PR's correctness preflight covered 82 differential queries with identical PK membership and float32 score bits, and the paired 2.3M-document benchmark completed all 10 cells with zero errors/timeouts, but was markedPERF_INCONCLUSIVE_HOST_BUSYbecause the host was shared.QA required: yes. Remaining testing scope is the production positional FULLTEXT2 entry point (
MATCH ... AGAINST (... IN NATURAL LANGUAGE MODE)) on currentmain: verify deferred phrase-position decoding for sparse and dense phrase intersections, single-slot/prefix fallback, WAND parity, result/score equivalence, and representative latency/throughput against the baseline. Expected PASS: identical result PK membership and float32 score bits, no errors/timeouts, and the intended sparse-intersection improvement without regression in the boolean MUST control. Expected FAIL: any correctness/score mismatch, timeout/error, or material regression in the covered control.Issue author is
VioletQwQ-0(notheni02), so the designated tester isAriznawlll.VioletQwQ-0 commentedon Aug 19, 2026
合并后关闭 Issue 的验证证据
实现已通过 #27165 合入主线。
b66120c91839aa2ec53f2a71cc0d025eb06894f2ec591dc9d4ec6b3beb81b804dac11aceb9b66441MATCH ... AGAINST (... IN NATURAL LANGUAGE MODE)根因与实现证据
修改前,
phraseCursor.doc()、phraseCursor.skipTo()与positions()使用同一个 block decoder。因此,每个被游标访问的 posting block 在所有 phrase cursor 对齐到共同文档之前,就会解码 position payload;对于稀疏 phrase intersection,其中大量 position 数据最终不会被使用。合并后的实现将文档块和位置块状态拆开:文档推进阶段只解码 document ordinal;只有所有游标对齐后请求
positions()时才解码 position,并保证每个 cursor/block 最多解码一次。本次改动不修改 SQL、DDL、索引/FST/posting 格式、CDC、runtime-filter 格式、phrase membership 或评分语义。
正确性证据
doc()、skipTo()不会解码 position block,直到positions()被调用。git diff --check均通过。float32score bits 完全一致。float32score bits 完全一致。2,303,643 文档性能证据
配对 A/B 使用同一份只读 positional gojieba FULLTEXT2 索引和固定 query pack:
b903ac6cdc6af77f01f27cc71c8cc4f29cfbe27c4b122c61861243abf3d67bddnatural_normal(200 条):f6ce089380452686462329a91b48da58e19d9399ec57ddc9c12fd8f224852934natural_mixed(188 条):a73f75109c0d460d020f2c587aec997fc7edd47150b46633535511cf28f91e94boolean_must(200 条):a5794b5e4c78513ae97098354d90da704d04ddbb1fd5d697599f1f3d876915bdlatest-main 配对测试每个 cell 预热 15 秒、测量 60 秒,并采用 A/C 交错顺序:
natural_normalnatural_mixedboolean_must控制组latest-main 的 10 个性能 cell 全部完成,0 error、0 timeout。
更早的同语料 30-cell 测试提供了更完整的 C1/C10 证据:
natural_normal:C1 为 2.41x,C10 为 3.01xnatural_mixed:C1 为 2.11x,C10 为 2.72xboolean_mustC10 控制组:0.979xCI 与证据边界
合并 PR 的 exact head 已完成所需 CI,包括 Ubuntu UT/coverage、SCA、Proxy/Multi-CN BVT、TKE Check-in BVT、TPCC、Sysbench、SSB 和 TPCH,结果均为成功。
mo-55 是共享测试主机,因此性能结果统一标记为
PERF_INCONCLUSIVE_HOST_BUSY:配对测试可以证明性能改善方向,但不发布绝对 QPS/P99。以上构成开发侧的实现、语义一致性、回归测试和真实数据性能证据。当前 Issue 仍处于
phase/testing;指定测试人员在 current main 上验证 Natural Language Mode 生产入口,确认结果及 score 一致、0 error、0 timeout,且 Boolean 控制组无明显回退后,即可关闭本 Issue。perf(fulltext2): decode phrase positions after doc alignment (matrixo…
perf(fulltext2): decode phrase positions after doc alignment (matrixo…
perf(fulltext2): decode phrase positions after doc alignment (matrixo…
Ariznawlll commentedon Sep 18, 2026
测试版本
main6690f1af97977ad5671235e9204296cd2d504ad5原问题验证
以 2,303,643 行固定语料运行生产 Natural Language Mode workload。gojieba 依次执行
natural_short(200 条)、natural_normal(200 条)和natural_mixed(188 条)query pack;每 cell 预热 60 秒、测量 10 分钟,合计 588 条固定查询。三组均为 0 error、客户端退出码 0:本 issue 的修复前/后 A/B 已在此前验收完成;本轮不重复 A/B,只以当前 main 的正式性能回归验证持续稳定性和控制路径。
验证范围与结果
fulltext2_search。boolean_must200 条控制组完整执行,0 error,QPS 2551.4245、P99 9.95 ms;未观察到 Boolean 控制路径回归。既有语义覆盖
float32score bits 为 oracle。白盒验证
pkg/fulltext2/phrase_cursor_test.go和phrase_perf_bench_test.go。doc()/skipTo()在调用positions()前不解码 position block,并覆盖 phrase 结果与 score 差分。回归测试
natural_short,natural_normal,natural_mixed,boolean_must,bm25_bow、C10、每 cell 10 分钟测量、CPU/RSS/QPS/P99 采样及 0-error 校验。测试证据
fulltext-parser-regression/summary.tsv记录 gojieba Natural Language 三组 workload 的 query pack hash、成功次数、0 error、QPS 与 P99;Boolean 控制组同一产物中为 0 error。ec591dc9d4ec6b3beb81b804dac11aceb9b66441。测试结论
测试通过。