SQLSTATE 53300 FATAL Class 53: Insufficient Resources

too_many_connections too many connections for role “…” — 53300

PostgreSQL error "too many connections for role "…"" (SQLSTATE 53300): what it means, common causes, and how to fix it.

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

Diagnostic Queries

Symptoms

A role hit its per-role connection limit set by ALTER ROLE … CONNECTION LIMIT. PostgreSQL refuses the new connection with SQLSTATE 53300 (too_many_connections).

  • The role’s active connections reached its CONNECTION LIMIT.
  • New connections for that role are rejected.
  • Other roles may still connect normally.

What the server log shows

FATAL:  too many connections for role "app_user"

Why PostgreSQL raises this — what the manual says

As the ALTER ROLE reference (Parameters) explains:

The role has reached the maximum number of concurrent connections set by its CONNECTION LIMIT (ALTER ROLE name CONNECTION LIMIT n); raise the limit or wait for some of the role’s existing sessions to disconnect.

Each role can carry a per-role cap on concurrent sessions. When the role’s active connection count reaches that cap, PostgreSQL rejects further logins for that role with 53300, even if the cluster-wide limit has room.

Common causes

  • The role’s CONNECTION LIMIT is set too low for the workload.
  • Connection leaks holding sessions open.
  • A surge in concurrent clients using that role.

Relevant GUC parameters

Parameter Default Effect
max_connections 100 Cluster-wide cap; the per-role limit applies on top of it.

How to fix it

  1. Raise the limit: ALTER ROLE app_user CONNECTION LIMIT 200;.
  2. Use a connection pooler (PgBouncer) to bound and reuse connections.
  3. Find and fix connection leaks in the application.

Diagnostic query

SELECT rolname, rolconnlimit FROM pg_roles WHERE rolname = 'app_user';

Compare the limit against current connections in pg_stat_activity for that role.

Related & next steps

Reference: PostgreSQL 18 — ALTER ROLE.

Was this helpful?