feat(proposals): Phase 7 — composite indexes for proposal list query patterns
Migration 0044 adds 4 CONCURRENTLY-built indexes:
1. ix_musehub_proposals_repo_state_created (repo_id, state, created_at DESC) Covers: WHERE repo_id = ? AND state = ? ORDER BY created_at DESC/ASC Pattern: newest / oldest sort — the 90% case
2. ix_musehub_proposals_repo_state_risk (repo_id, state, risk_score DESC NULLS LAST) Covers: WHERE repo_id = ? AND state = ? ORDER BY risk_score DESC/ASC Pattern: risk_desc / risk_asc sort
3. ix_musehub_proposal_reviews_proposal_state (proposal_id, state) Covers: WHERE proposal_id IN (?) AND state = 'approved' GROUP BY proposal_id Pattern: _prefetch_for_batch approval count query
4. ix_musehub_identities_handle_type (handle, identity_type) Covers: WHERE handle IN (?) AND identity_type = 'agent' Pattern: author_type filter JOIN
ORM model __table_args__ updated to match (MusehubProposal, MusehubProposalReview, MusehubIdentity).
EXPLAIN harness: 5 tests verify index presence in pg_catalog and confirm index-based access plans for each query pattern.
Completes issue #35 — Proposals List: State Transition Queue.
0 comments
muse hub commit comment sha256:b26003ce4b5387465ee38372620c7c3dc422c15b6cd3a43ca021f5eb6f6aa48c --body "your comment"
No comments yet. Be the first to start the discussion.