Diagnose and resolve database performance issues:
Current state:
- PostgreSQL database
- ~2 million rows in primary table
- Query times degrading (specifics needed: which queries?)
- Application: [SaaS product type]
Investigate:
1. Common causes of degradation at this scale
(indexing, query patterns, connection pooling, hardware)
2. Diagnostic steps: What to check first
(EXPLAIN ANALYZE patterns, pg_stat_statements, index usage)
3. Quick wins: Optimizations achievable without schema changes
4. Medium-term: Schema/architecture improvements if needed
5. When to consider: Read replicas, caching layer, or different DB entirely
Prioritize solutions by: impact, implementation effort, and risk.
At 2M rows, this shouldn't be slow - focus on identifying the
root cause before jumping to solutions.