Add database index on subscriptions.user_id for fast billing lookups #602

Open
opened 2026-04-11 04:34:52 -04:00 by pook · 0 comments
Owner

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)

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)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#602
No description provided.