0052_object_refs_object_id_index.py
python
sha256:1dd27e6d5c24550177b01b0a171e8375c07cf046b549e7683364706b6522d3bc
docs(#139): mark all 11 checklist items resolved, document …
Sonnet 5
12 days 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
2 commits
sha256:1dd27e6d5c24550177b01b0a171e8375c07cf046b549e7683364706b6522d3bc
docs(#139): mark all 11 checklist items resolved, document …
Sonnet 5
12 days ago
sha256:649011bedd713e22f7dca4c4be94bdefbf3b10950d9fc80235928d0b0b823be8
docs: track issue #139 (two-column app-shell refactor) plan…
Sonnet 5
12 days ago