Skip to content

perf: prune scalar index segments by fragment scope - #9449

Merged
yanghua merged 1 commit into
lance-format:mainfrom
ddupg:perf/scalar-prefilter-segment-pruning
Sep 22, 2026
Merged

yanghua merged 1 commit into
lance-format:mainfrom
ddupg:perf/scalar-prefilter-segment-pruning

Conversation

@ddupg

@ddupg ddupg commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Part of #9282.

Scalar filters currently open every usable segment of a named index, even when the read or search only needs a subset of fragments. This prunes segments whose coverage does not intersect that scope before opening them, including ordinary scans and scalar prefilters for vector and full-text search.

Partially overlapping segments remain eligible. The serialized result coverage is restricted to the evaluated scope, while existing filtered-read fallback, rechecks, and direct-prefilter eligibility remain unchanged.

Validation:

  • 10 focused cases covering segment loading, NOT, stable row IDs, explicit fragments, ordinary scans, vector search, and FTS.
  • 14 external-mask and scalar coverage/fast-search regression cases.
  • 10 count-pushdown regression cases.
  • cargo fmt --all.
  • cargo clippy --all --tests --benches -- -D warnings.

@ddupg
ddupg force-pushed the perf/scalar-prefilter-segment-pruning branch from 47e93cc to 2dbc370 Compare September 21, 2026 07:03
@ddupg
ddupg marked this pull request as ready for review September 21, 2026 07:03

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Gate recommendation: approve.

This keeps the optimization at the scalar-index loading boundary: only physical segments intersecting the scanner’s established fragment scope are opened, while partial overlaps, serialized coverage, fallback scans, stable row IDs, and prefilter behavior retain their existing semantics. Keeping unscoped callers unchanged is preferable to widening the scalar-index trait or changing result-mask semantics globally.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 21, 2026

@yanghua yanghua left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

+1

@yanghua
yanghua merged commit 2ef9f9f into lance-format:main Sep 22, 2026
38 of 39 checks passed
LuQQiu added a commit that referenced this pull request Sep 23, 2026
Combination tests for FRI v1 composed with #9449 scalar fragment-scope pruning.
The pruning consumes each segment's FRI-effective coverage, so a query scoped to
one reclustered destination keeps every source segment that contributed to it
and prunes segments that do not intersect it. The derived-listing cache holds the
full effective listing per snapshot, so scoping one query does not poison the
next on the same snapshot.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
LuQQiu added a commit that referenced this pull request Sep 23, 2026
Combination tests for FRI v1 composed with #9449 scalar fragment-scope pruning.
The pruning consumes each segment's FRI-effective coverage, so a query scoped to
one reclustered destination keeps every source segment that contributed to it
and prunes segments that do not intersect it. The derived-listing cache holds the
full effective listing per snapshot, so scoping one query does not poison the
next on the same snapshot.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

K-approved Latest Gatekeeper recommendation permits acceptance. performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants