perf(index): cache small-index posting, doc, and vector-probe reads#7258
Closed
hamersaw wants to merge 1 commit into
Closed
perf(index): cache small-index posting, doc, and vector-probe reads#7258hamersaw wants to merge 1 commit into
hamersaw wants to merge 1 commit into
Conversation
Querying a small FTS index (e.g. a mem_wal flushed generation) re-paid object-store IO on every query for metadata that is never cached: 1. `posting_len_for_token` / `posting_metadata_for_token` issued one tiny single-row `read_range` per term per partition. For a small index, bulk- load the whole posting metadata once into the cached `OnceCell` instead (`small_index_bulk_metadata`, ≤256Ki tokens); large indexes keep the uncached single-row path. 2. `DeferredDocSet::resolve_row_ids` did targeted (uncached) row-id reads every query. For a small partition (≤256Ki docs) load and cache the whole ROW_ID column instead. 3. The "is this a vector index?" file-existence probe for indexes without `files` metadata issued a HEAD per generic open. Memoize it per uuid in the session index cache (`IsVectorIndexProbeKey`). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
This PR was fixing a performance issue on a path we should not have been on, closing accordingly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Querying a small full-text index (e.g. a mem_wal flushed-generation index) re-paid object-store IO on every query for metadata that is never cached. Three uncached read paths, each fixed for small indexes while leaving large-index behavior unchanged:
posting_len_for_token/posting_metadata_for_tokenissued one tiny single-rowread_rangeagainst the posting file per term per partition, never cached. For a small index (≤256Ki tokens) bulk-load the whole posting metadata once into the existingOnceCell(small_index_bulk_metadata); large indexes keep the O(1) single-row path.DeferredDocSet::resolve_row_idsdid targeted (uncached) row-id reads on every query. For a small partition (≤256Ki docs) load and cache the wholeROW_IDcolumn instead.filesmetadata issued a HEAD per generic open. Memoize per uuid in the session index cache (IsVectorIndexProbeKey).Changes
lance-index/.../inverted/index.rs:small_index_bulk_metadata+ updatedtest_bm25_stats_for_terms_is_lazy.lance-index/.../inverted/lazy_docset.rs: small-partition row-id column caching inresolve_row_ids.lance/src/index.rs: memoizedis_vector_indexexistence probe.lance/src/session/index_caches.rs:IsVectorIndexProbecache key.Validation
cargo test -p lance-index test_bm25_stats_for_terms_is_lazypasses (asserts the first stats lookup issues exactly one posting read and subsequent lookups issue none). Validated end-to-end against a WAL FTS benchmark: a warm query dropped from re-reading per-term posting offsets + doc row-ids + the vector probe each query to zero such reads (all served from cache).🤖 Generated with Claude Code