PostgreSQL too_many_connections
PostgreSQL rejected a new session because the server has reached its usable connection limit.
FATAL: remaining connection slots are reserved for non-replication superuser connectionsAlso searched as: too_many_connections · sorry, too many clients already
What it means
The server cannot allocate another ordinary backend. The configured maximum includes reserved capacity, so application clients can be rejected before the raw max_connections value appears fully consumed.
Typical trigger conditions
- An application connection leak
- A traffic spike without pooling
- Too many pool instances or oversized per-instance pools
- Long-lived idle sessions consuming the connection budget
First diagnostic checks
Count sessions by state
Identify whether active work or idle clients are consuming the budget.
SELECT state, count(*) FROM pg_stat_activity GROUP BY state ORDER BY count(*) DESC;
Find the largest client groups
Group sessions by application and source before terminating anything.
SELECT application_name, client_addr, count(*) FROM pg_stat_activity GROUP BY 1,2 ORDER BY 3 DESC;
Compare configured capacity
Check max_connections and the reserved slots on the affected server.
SHOW max_connections; SHOW superuser_reserved_connections;
Version and platform notes
Reserved-connection settings vary by PostgreSQL version. Check the documentation for the deployed major version before changing capacity.
Continue the investigation
Follow PostgreSQL failures and fixes
One useful weekly email with new error references, tools, integration notes and production lessons. No daily noise.