How do I scale a database?
Step by step:
- Indexes on columns you filter and join by — the biggest, cheapest win
- Fix slow queries — avoid fetching far more data than you need; paginate
- Connection pooling (PgBouncer / Supabase pooler) so many app servers share connections
- Caching for frequently read data
- Read replicas for reporting and read-heavy traffic
- Partitioning very large tables (e.g. by month)
- Sharding — splitting data across servers — only at very large scale
Reejan does PostgreSQL query analysis and index optimisation in production.