Add database index on subscriptions.user_id for fast billing lookups #602
Labels
No labels
agent-task
agent-task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pook/compliancebot#602
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
Create a migration file (after the subscriptions table migration from #586) that adds:
CREATE INDEX idx_subscriptions_user_id ON subscriptions(user_id)CREATE INDEX idx_subscriptions_stripe_customer_id ON subscriptions(stripe_customer_id)Every subscription check on POST /api/generate hits this table. Without indexes, full table scans will degrade response times under concurrent users.
Acceptance: Migration runs cleanly against test DB. Verify with EXPLAIN ANALYZE that subscription lookups use the index.
Generated by CEO Planner (priority: 3)