gabriel / musehub public
perf BREAKING task/phase3-branch-name-index #1 / 1
AI Agent gabriel · 124 days ago · May 12, 2026 · Diff

perf: add composite (repo_id, name) index on musehub_branches

get_branch_head_commit_id() does a WHERE repo_id = ? AND name = ? point lookup on every push and fetch. Previously only a single-column repo_id index existed, requiring a filtered scan of all branches for the repo.

The composite index also eliminates the in-memory sort for list_branches_with_detail() ORDER BY name — the index covers both clauses.

Migration 0057 creates the composite index and drops the now-redundant single-column repo_id index (covered by the leftmost prefix).

sha256:81c275295dab8d63641f74e3d9d5f4c563f2a9f5212504d40cb6d7e8a22e8eb6 sha
+8 ~3 symbols
sha256:fe5f879bd8f1294e97f197c75c85cbc169caee738231111b705f676038d50dad snapshot
+8
symbols added
~3
symbols modified
0
dead code introduced
Semantic Changes 11 symbols
+ branch_labels variable variable branch_labels L17–17
+ depends_on variable variable depends_on L18–18
+ down_revision variable variable down_revision L16–16
+ downgrade function function downgrade L33–39
+ annotations import import annotations L11–11
+ op import import op L13–13
+ revision variable variable revision L15–15
+ upgrade function function upgrade L21–30
~ musehub/db/musehub_models.py .py 1 symbol modified
← Older Oldest on task/phase3-branch-name-index
All commits
Newer → Latest on task/phase3-branch-name-index

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:81c275295dab8d63641f74e3d9d5f4c563f2a9f5212504d40cb6d7e8a22e8eb6 --body "your comment"