Repository navigation
perf(collections): rank only the collection's repositories - #215
Merged
Merged
Conversation
Collection detail ranked every Skill in the registry and ran a correlated repo Skill count per row before joining the collection: 1.69M rows read per call, 291.6M over 173 calls between 7 and 14 Sep 2026. The manifest and index handlers ranked the whole table too, at about 64K rows per call. The rank partitions by repository, so limiting the CTE to the collection's repositories leaves every rank unchanged. On production data collection 150 returns identical rows at 637 rows read, manifest at 471, index at 2,238. Claude-Session: https://claude.ai/code/session_014N85FDJLggfBs3BHJXT7GZ
Contributor
🤖 MERGED
GitHub merged this pull request. No material findings were recorded. 134b8ab9-1ccb-4249-b074-2ddaa40db840 |
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.
Why
Collection detail was the largest skilld-db statement that #212 left alone. It ranked every Skill in the registry and ran a correlated repo Skill count per row, then joined the collection.
ranked_skillsThe manifest and index handlers use the same CTE without the count, at about 64K rows per call and low volume.
Change
rnpartitions by repository, so every rank stays the same.?1in both places. The index binds its id list twice.Verification
Production skilld-db, read-only. Result rows hashed in order.
Projected saving: about 41M rows read a day.
test/unit/collection-detail.test.tscovers a named Skill, a repository entry picking its newest Skill, and a repository outside the collection. Narrowing the new filter makes it fail.pnpm typecheck: passeslinton changed files: passvitest run test/unit: 242 files, 1,690 tests passhttps://claude.ai/code/session_014N85FDJLggfBs3BHJXT7GZ