SQLSTATE 53300 FATAL Class 53: Insufficient Resources

too_many_connections remaining connection slots are reserved for non-replication superuser connections — 53300

PostgreSQL error "remaining connection slots are reserved for non-replication superuser connections" (SQLSTATE 53300): what it means, common causes, and…

PG 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed May 2025 Grounded in source

Diagnostic Queries

Symptoms

The server is near its connection limit and the only free slots are reserved for superusers (via superuser_reserved_connections). A normal role’s connection is refused with SQLSTATE 53300 (too_many_connections).

  • Appears when connections approach max_connections.
  • Superusers can still connect; ordinary roles cannot.
  • Usually a symptom of connection leakage or missing pooling.

What the server log shows

FATAL:  remaining connection slots are reserved for non-replication superuser connections

Why PostgreSQL raises this — what the manual says

Section 19.3.1 Connection Settings (superuser_reserved_connections):

“Whenever the number of active concurrent connections is at least max_connections minus superuser_reserved_connections, new connections will be accepted only for superusers.”

PostgreSQL keeps superuser_reserved_connections slots out of max_connections for superusers so admins can always get in. Once non-reserved slots are exhausted, ordinary connections are refused with 53300.

Common causes

  • More client connections than the server is sized for (no pooling).
  • Connection leaks in the application that never release sessions.
  • A spike in traffic or a stuck pool holding connections open.

Relevant GUC parameters

Parameter Default Effect
max_connections 100 Total connection slots available on the server.
superuser_reserved_connections 3 Slots held back exclusively for superusers.
reserved_connections 0 Slots reserved for roles with pg_use_reserved_connections (PG16+).

How to fix it

  1. Introduce a connection pooler (PgBouncer) so apps share fewer server connections.
  2. Find and fix connection leaks; ensure pools have sane max sizes.
  3. Raise max_connections only if the server has the memory headroom (requires restart).

Diagnostic query

-- Who is using the connections right now?
SELECT usename, state, count(*)
FROM pg_stat_activity
GROUP BY usename, state
ORDER BY count(*) DESC;

Related & next steps

Reference: PostgreSQL 18 Section 20.3 “Connections and Authentication”.

Was this helpful?