0052_object_refs_object_id_index.py
python
sha256:3ff9c9863a9891bdcde71b4a43228f66d0493e38b7cc1d09fe9eb7de774046b2
feat: add repair-commit wire endpoint (API parity with repa…
Opus 4.8
minor
⚠ breaking
1 day ago
| 1 | """Add index on musehub_object_refs(object_id) for fast bulk object lookups. |
| 2 | |
| 3 | The composite PK (repo_id, object_id) is optimal for queries that filter on |
| 4 | both columns. The push path queries object_refs by a large IN |
| 5 | list of object_ids (up to ~8000) with a fixed repo_id. The existing PK covers |
| 6 | this case, but an additional single-column index on object_id alone helps the |
| 7 | planner choose bitmap index scans when the IN list is large and repo_id has |
| 8 | high selectivity. |
| 9 | |
| 10 | Revision ID: 0052 |
| 11 | Revises: 0051 |
| 12 | """ |
| 13 | from __future__ import annotations |
| 14 | |
| 15 | from alembic import op |
| 16 | |
| 17 | |
| 18 | revision: str = "0052" |
| 19 | down_revision: str = "0051" |
| 20 | branch_labels = None |
| 21 | depends_on = None |
| 22 | |
| 23 | |
| 24 | def upgrade() -> None: |
| 25 | op.create_index( |
| 26 | "ix_musehub_object_refs_object_id", |
| 27 | "musehub_object_refs", |
| 28 | ["object_id"], |
| 29 | unique=False, |
| 30 | ) |
| 31 | |
| 32 | |
| 33 | def downgrade() -> None: |
| 34 | op.drop_index("ix_musehub_object_refs_object_id", table_name="musehub_object_refs") |
File History
1 commit
sha256:3ff9c9863a9891bdcde71b4a43228f66d0493e38b7cc1d09fe9eb7de774046b2
feat: add repair-commit wire endpoint (API parity with repa…
Opus 4.8
minor
⚠
1 day ago