Repository navigation
Text index: fast-path for filter-only postprocessors - #109049
Conversation
Filter-only postprocessors (`if(..., '', token)`) now build the granule from raw tokens and drop the empties at build time, avoiding the general path's per-occurrence materialization and `ActionsDAG` run.
|
Workflow [PR], commit [1eb62b4] Summary: ❌
AI ReviewSummaryThis PR now limits the fast path to literal Final Verdict
|
|
📊 Cloud Performance Report ✅ AI verdict: This PR adds an INSERT-time fast path for text-index postprocessor IN/NOT IN stop-word filters, so it only affects text-index building — never query execution. None of the flagged ClickBench queries use a text index or its postprocessor, so all three deltas are off-path run-to-run variance rather than PR effects. Q4's -11.8% is correctly suppressed inside master's variance band; Q15's -22.2% flagged improvement is downgraded to not_sure as off-path; Q18 is borderline and likewise unrelated to the change. clickbenchFlagged queries (2 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🟢 No significant changes Debug info
|
Ergus
left a comment
There was a problem hiding this comment.
I like this idea, it a good point in between a skip words list without breakinbg the postprocessor semantic ;)
- We need some tests (many if possible ;p ).
- The hybrid IN path is completely uncovered (not in existing tests for postprocessor because that path was not special, but now it is)
- Of course we need some performance test to ensure/prove that this improves performance as expected and worth the extra code/complexity.
9e859fb to
168d7f6
Compare
…or-token-filter-fast-path
…OT IN` The postprocessor fast path had two branches: a generic filter-only flush path (build every token, then drop the distinct ones the postprocessor maps to `''` at segment flush) and the `IN`/`NOT IN` hybrid (drop per distinct token in `addToken`, so dropped tokens never build postings). The generic flush path built posting lists for tokens it would discard and counted those dropped occurrences toward the segment-flush threshold, so on high-drop non-`IN` filters (e.g. `if(lengthUTF8(token) < 3, '', token)`) it could increase temporary-segment churn, and it was never benchmarked against the general path. Keep only the `IN`/`NOT IN` hybrid - the benchmarked, memory-bounded case - and route every other filter-only postprocessor through the general per-batch path (identical to the behaviour before the fast path existed). This removes `use_filter_fast_path`, `filterTokens`, `dropped_tokens` and `isFilterOnlyExpression`, and makes `build` unable to silently drop a token (it no longer skips anything).
Rename `use_hybrid_filter` -> `use_postprocessor_drop_fast_path` and `token_drop_filter` -> `postprocessor_drop_filter` so the names link to the postprocessor and drop the too-generic "hybrid" term.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 80/97 (82.47%) · Uncovered code |
@groeneai can you check the reason? |
|
Acknowledged. Investigating why the filter-only fast-path shows no improvement / a small slowdown in the CI perf comparison versus your dev-time benchmark: I'll reproduce the text-index perf test on the merged head, profile the raw-token granule build against the general path, and follow up here with findings (and a fix PR if a real regression is confirmed). |
|
Checked the CI perf comparison (release builds, head Query (
The fast path is active: Where the time went (profile events, base vs head, same query):
So the whole regression is inside the text-index build. Why the win doesn't show on this dataset (and likely why it differs from your dev benchmark): the test builds 1M rows x 30 tokens = 30M occurrences; ~2/3 survive and are high-cardinality ( The scalar-vs-vectorized membership-test part is a hypothesis, not measured; the localization above is measured. If your dev benchmark used fewer distinct surviving tokens or a higher drop ratio, that would explain the improvement there. I can profile the build stage to confirm the micro-cause before you decide whether it is worth tuning. |
|
Hi @ahmadov @Ergus @rschu1ze — while reviewing this PR I found the following:
Could you review the test PR and add the |
…essor-token-filter-fast-path Text index: fast-path for filter-only postprocessors
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Filter-only postprocessors (
if(..., '', token)) now build the granule from raw tokens and drop the empties at build time, avoiding the general path's per-occurrence materialization andActionsDAGrun.Version info
26.7.1.1313(included in26.7and later)