fix(db): index the keyword projection by document, and drop the unread binary ANN indexes - #8105
Merged
Merged
Conversation
Ranking walks the half-precision graphs; nothing has ordered by a hamming distance on the projection since half-precision search shipped, so the five binary-quantized HNSW indexes were maintained on every chunk write for nothing, and the populated one doubled the per-row cost of filling the projection's source and ACL columns. Dropped concurrently; the binary columns stay until the sync trigger stops writing them.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
No issues found across 4 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
Contributor
|
… trigger The document ACL trigger updates the keyword projection by document id; the projection had no index on that column, so every document ACL or source change scanned the whole projection. Adds the index concurrently.
…ent index on replay
This branch was successfully deployed
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
embedding_keyword_tinbydocument_id, and that projection had no index on the column. Every document ACL or source change scanned the whole projection; on a large deployment that is seconds per document update, thousands of times a day, and it slows every connector sync and the projection backfill with it. Addsembedding_keyword_tin_document_idxconcurrently, mirroring the index the GIN keyword projection already hasembedding_search. Ranking walks the half-precision graphs and no code path orders by a hamming distance on this projection, so they were maintained on every chunk write for nothing; the populated one doubles the per-row cost of the projection backfill. Drops runCONCURRENTLYwith theCOMMITbreakpoint and lock-timeout handling the earlier index-drop migration usescontract-pendingmarker in the schema now says soType of Change
Testing
bun run check:migrations origin/stagingpasses (backward-compatible)bun run lintandbun run check:auditspassChecklist