[python] Add explain and profiling for local search - #9833
Open
TheR1sing3un wants to merge 8 commits into
Open
TheR1sing3un wants to merge 8 commits into
TheR1sing3un wants to merge 8 commits into
Conversation
TheR1sing3un
marked this pull request as ready for review
September 15, 2026 05:58
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.
Purpose
Add
explain()and opt-inprofile()to local vector, batch vector, full-text, and hybrid search builders and multimodal queries. Users can inspect planned index coverage and raw fallback, then identify time spent in index search, filtering, refinement, fusion, and result lookup.This branch includes the snapshot consistency fix from #9843. Each execution uses one read view across routes, filtering, raw fallback, and result lookup. Query reuse resolves a fresh snapshot, while explicit time-travel selectors remain effective. The fix can land independently before this feature.
explain()returns a structured, printable plan without running vector/text search.profile()executes once and returns the normal result together with the plan, stage timings, and counters:Coverage uses unions of planned row-ID ranges and reports indexed/raw overlap; it does not estimate live rows or recall. Primary-key source-file coverage is reported as unavailable. Profiles preserve route order and hybrid concurrency, report actual lookup snapshot IDs, and keep timing/counter collection disabled for ordinary execution. Stage times are inclusive and can overlap. Index reader cleanup is shared across vector, batch, and full-text searches; profiled futures publish results only after cleanup and do not allow wrapper cancellation to close a running reader. Diagnostic planning does not separately parse or validate refinement options.
Document the APIs, result types, counter definitions, and measurement limits, including partial instrumentation of primary-key readers.
Tests
The latest full CI run passed, including Rust main
66f655b30a38: 5,230 tests passed, 124 skipped, and 2,250 native plans exercised.After syncing with master and its incremental-read semantics, 399 passed and 47 skipped in the targeted Python 3.9 regression run: