# Postgres error 53300: sorry, too many clients already / remaining connection slots are reserved

> The server has reached max_connections and refused a new connection.

Source: https://scribase.com/postgres-errors/53300

SQLSTATE class: Insufficient Resources. Over PostgREST/supabase-js this maps to HTTP 503.

## Causes

- Serverless functions or many app instances each opening their own pool.
- Connection leaks: connections taken from a pool and never returned.
- Idle sessions left open by tools and notebooks.

## Fixes

- Put a connection pooler in front of the database and connect through it, or use an HTTP driver from serverless code.
- Lower the pool size per instance; total = instances x pool size must stay under the limit.
- Find idle sessions: select pid, usename, application_name, state, state_change from pg_stat_activity order by state_change;

Through PostgREST this shows as 503.