gabriel / musehub public
0052_object_refs_object_id_index.py python
34 lines 943 B
Raw
sha256:969ddc5e88776e70af33c016b8777bb721356508ae5f304b3fb46c451494ece7 test(mwp3): Phase 4 — fix adjacent suite regressions, lock … Sonnet 4.6 22 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:969ddc5e88776e70af33c016b8777bb721356508ae5f304b3fb46c451494ece7 test(mwp3): Phase 4 — fix adjacent suite regressions, lock … Sonnet 4.6 22 days ago
sha256:1749b9cc5cd2583c56d3261c4c00a342c27435f3946d4bc3e70f76aa2795458a docs(mwp-3): TDD implementation plan for job-enqueue idempo… Opus 4.8 22 days ago