Repository navigation
Text index: pre-insert the postprocessor stop words into the token map - #111690
Conversation
Before, every token was hashed twice during the index build: once to check it against the stop-word list and once to add it to the token map. Now the stop words are put into the map up front and marked, so the map lookup alone tells whether to keep or drop a token.
|
Workflow [PR], commit [bc68a9b] Summary: ✅
AI ReviewSummaryThis PR rewires the text-index filter-only postprocessor fast path so the builder can reuse per-token state instead of consulting the filter set on every occurrence, and it broadens the performance benchmark coverage. The main logic looks consistent with the existing functional tests, but the new keep-set seeding path still bypasses Findings
Tests
Final VerdictChanges requested: the seeded-memory accounting gap breaks the contract of LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 77/81 (95.06%) · Uncovered code |
Ergus
left a comment
There was a problem hiding this comment.
The first comment is the only real issue IMO.
| /// `NOT IN`: invert so `shouldDrop` fires for tokens outside the set. | ||
| filter.drop_on_match = is_not_in ? !drop_on_condition : drop_on_condition; | ||
|
|
||
| if (literals.size() > max_filter_set_size) |
There was a problem hiding this comment.
This disables the drop-set fast path right? Is it intended?
There was a problem hiding this comment.
yes, it's intended. Having more than 8192 tokens in the filter would follow the normal path. It would happen very rarely at all.
|
📊 Cloud Performance Report 🟢 AI verdict: This PR's only functional change is the text-index build fast path for IN/NOT IN filter postprocessors (MergeTreeIndexText); the rest is a perf-test XML update. ClickBench and TPC-H queries never build or query these text indexes, so none of the flagged improvements can be attributed to the diff. Six moderate ClickBench deltas were downgraded as off-path variance. Three very large deltas remain flagged only because they clear the hard trust threshold (clickbench Q23 ×2.2 faster, tpch_adapted_1_official Q7 ×8.2 faster, Q8 ×2.1 faster), but they exercise no changed code and most likely reflect a baseline/measurement shift — verify before treating them as real gains. clickbench🟢 1 improved · Flagged queries (7 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 2 improved Flagged queries (2 of 22)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. Debug info
|
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 77/81 (95.06%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units30 translation units recompiled, 287 s compile time in total, 30 of them have a recent master baseline. |
|
@ahmadov @Ergus — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
All four entries of tests/performance/text_index_postprocessor_filter.xml
take 1.07-1.27 s on MasterCI (amd, arm 1.01-1.19 s). Each INSERT reads 3M
rows and writes three ~1M-row parts in parallel, so a run takes about one
part's text index build and write; half the rows would still write a
~1M-row part.
No existing query number or text changes: 2 queries (4 entries with the
substitution) are disabled and 2 copies (4 entries) appended as 4-7. The
copies read the first 500k of the same rows (the source fill is renamed
to tab_src_500k_{drop_pct}, read only by the copies) and write one part
of 500k rows into the same target tables.
Local A/B on official builds, two repetitions on different NUMA nodes,
L3 capped to one way (decide.py v2: every gate passes in both):
- per-row index and compression time of a copy 0.986-1.009 of its
original, bytes per row 1.000, index share of the part write +-0.002;
- local time ratio copy/original 0.421-0.462 -> projected CI medians
0.45-0.58 s amd, 0.42-0.54 s arm;
- on the MasterCI builds before and after ClickHouse#111690 (608eeb8 -> 04971e1,
CI measured 1.28-1.40x on amd), the copies keep 0.77-1.05 of the
original's speedup, both seat orders.
Saving: about 25 s of query time per master perf job on each
architecture; the setup fills 1.5M instead of 9M rows.
Related: ClickHouse#129258
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A follow-up of 109049.
Before, every token was hashed twice during the index build: once to check it against the stop-word list and once to add it to the token map.
Now the stop words are put into the map up front and marked, so the map lookup alone tells whether to keep or drop a token.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Reduce hashing of tokens defined in the postprocessor
IN/NOT INfilter.Workflow [PR]
Sync PR [sync-upstream/pr/111690]