Add missing database indexes on tenant_id, created_at, and release_state #12
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Migrations show no indexes on columns that are filtered and sorted in every request:
tenant_id— appears in WHERE clause of every query across all tablescreated_at— used for default sort order on list endpointsrelease_state— filtered in canonical_controls queriesAt scale, these cause full table scans (O(n)) instead of index seeks (O(log n)).
Required Actions
migrations/— identify tables missing index ontenant_idCREATE INDEX idx_<table>_tenant_created ON <table>(tenant_id, created_at DESC)CREATE INDEX idx_canonical_controls_release_state ON canonical_controls(tenant_id, release_state)CONCURRENTLYto avoid table locks on live data:CREATE INDEX CONCURRENTLYAcceptance Criteria
(tenant_id, created_at)index[migration-approved]commit marker per CLAUDE.md