Scaling

How do I scale a database?

Step by step:

  1. Indexes on columns you filter and join by — the biggest, cheapest win
  2. Fix slow queries — avoid fetching far more data than you need; paginate
  3. Connection pooling (PgBouncer / Supabase pooler) so many app servers share connections
  4. Caching for frequently read data
  5. Read replicas for reporting and read-heavy traffic
  6. Partitioning very large tables (e.g. by month)
  7. Sharding — splitting data across servers — only at very large scale

Reejan does PostgreSQL query analysis and index optimisation in production.

All guides