fix(sqlite_exact): cut remaining palace-wide read paths - #2311
Merged
Conversation
list_drawers(limit=20) still materialized every matching drawer (documents + embeddings). get(ids=...) scanned the whole collection. Search ran a second exact-cosine over 166k closets. Status/list_wings re-ran the 1s json_extract GROUP BY on every call. graph_stats had no sqlite_exact fast path and paged all metadata. - get() selects only requested columns; get(ids=) uses IN; equality where + LIMIT go to SQL - list_drawers walks metadata only, then hydrates the page - 5s taxonomy cache, dropped on writes - graph_stats uses json_extract GROUP BY on sqlite_exact - closet boost uses FTS lexical_search instead of cosine Isolated live palace (167k drawers): full-row fetch 806ms vs metadata 591ms vs LIMIT 20 / IN 20 at 0ms. Taxonomy GROUP BY ~1s, then cached.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Follow-up to #2308. Search/status cosine and metadata paging are better; these were the next palace-wide reads on the live 167k-drawer
sqlite_exacthub.Does not touch
chroma.py.Changes
get()no longer loads the whole palaceget(ids=...)usesWHERE id IN (...)(was: scan every row, then dict lookup).include=["metadatas"]does not SELECTdocumentorembedding.where(wing/room/source_file) plusLIMIT/OFFSETgo to SQL.list_drawerspaginates for realtotal.content_previewfor the page viaget(ids=...).limit=20was 2752 ms because it loaded every document.Taxonomy cache (5s TTL)
status/list_wings/list_rooms/get_taxonomyshare one GROUP BY result._invalidate_overview_caches).graph_statssqlite_exact fast pathjson_extractroom/wing/hall GROUP BY.Closet boost is FTS, not a second cosine
Isolated SQL on this palace (167k drawers)
id, document, metadata_json, embeddingid, metadata_jsonLIMIT 20/IN 20Tests
uv run pytest tests/test_sqlite_exact_backend.py tests/test_mcp_server.py tests/test_searcher.py tests/test_closets.py— 586 passed.