gabriel / musehub public
0052_object_refs_object_id_index.py python
34 lines 943 B
Raw
sha256:20b27796ed512236119feef48b4577a8fd9ded05a15267dd4e6da23604ad1f1a docs: update Suggested Ownership Split table to reflect ful… Sonnet 5 27 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 3 commits
sha256:20b27796ed512236119feef48b4577a8fd9ded05a15267dd4e6da23604ad1f1a docs: update Suggested Ownership Split table to reflect ful… Sonnet 5 27 days ago
sha256:8ea2f75226d5834770ccaddbaa6efda1cc337446fd481bb385de8bec4555ae79 docs: Section 9 CI pipeline — confirm job queue is idempote… Sonnet 5 27 days ago
sha256:80e1a60a39562f6e616aaafbb27487f03abbec7d8ffc6164302b7a0c0bfc63ee docs: check off Section 0 items verified in inventory doc, … Sonnet 5 27 days ago