Skip to content

Reduce IndexOrDocValuesQuery DV penalty from 8x to 6x - #16576

Open
costin wants to merge 3 commits into
apache:mainfrom
costin:skipper-cost
Open

costin wants to merge 3 commits into
apache:mainfrom
costin:skipper-cost

Conversation

@costin

@costin costin commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Revisit the threshold in IndexOrDocValuesQuery for picking points vs DV (especially now with DocVlauesSkipper).
With block-level skipping, DV is competitive with points for selective leads in conjunctions. Reducing to 6x lets the DV path be chosen in the crossover regime, yielding 1.78x throughput on selective-lead queries without regressing any other case.

/4 was also tested but caused a 43% regression at 20% lead + 10M docs due to BKD cost estimation noise at
the threshold boundary

Benchmark

AMD EPYC 7R32 (c5a.2xlarge), JDK 25, 2 forks, 5 iters × 3s.
Index: monotonic timestamps + 100-bucket keyword field, forceMerge(1).
Queries: TermQuery lead (FILTER) + LongField.newRangeQuery (FILTER).

method lead range docs /8 (ops/s) /6 (ops/s) ratio
crossover10 10% 80% 1M 8,634 ± 66 15,362 ± 51 1.78x
crossover10 10% 80% 10M 285 ± 10 290 ± 1 1.02x
crossover20 20% 80% 1M 6,948 ± 141 6,835 ± 72 0.98x
crossover20 20% 80% 10M 183 ± 2 186 ± 0.4 1.02x
crossover30 30% 80% 1M 5,764 ± 47 5,832 ± 37 1.01x
crossover30 30% 80% 10M 72 ± 1 72 ± 1 1.01x
dvFavorable 1% 80% 1M 39,487 ± 161 39,658 ± 371 1.00x
dvFavorable 1% 80% 10M 4,508 ± 17 4,501 ± 18 1.00x
pointsFavorable 50% 5% 1M 4,693 ± 31 4,746 ± 18 1.01x
pointsFavorable 50% 5% 10M 2,350 ± 16 2,390 ± 13 1.02x

The crossover10 case (10% lead + 80% range, 1M docs) shows 1.78x: the reduced
divisor switches from points to DV, and DV with skip blocks is faster for this
selective-lead, broad-range pattern. All other cases show no regression.

Fix #16425

The 8x penalty was set in LUCENE-7897 (2017) before DocValuesSkipper
existed. With block-level skipping, DV is competitive with points
for selective leads in conjunctions. Reducing to 6x lets the DV path
be chosen in the crossover regime, yielding 1.78x throughput on
selective-lead queries without regressing any other case.

@utafrali utafrali left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core one-line threshold change is well-justified by the included JMH benchmark and the reasoning that DocValuesSkipper narrows the DV-vs-points gap since the original 8x heuristic was introduced. Approving with a few suggestions to tidy up stale exploratory comments and small polish items in the benchmark.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!

@github-actions github-actions Bot added the Stale label Sep 25, 2026
@javanna javanna added this to the 10.6.0 milestone Oct 1, 2026
@github-actions github-actions Bot removed the Stale label Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorporate DocValuesSkipper into IndexOrDocValuesQuery's cost decision

3 participants