SQLSTATE 53300Severity highLab verified

Incident brief

Too many connections

A non-superuser connection attempt arrived after every non-reserved connection slot was already in use. PostgreSQL rejected it so the reserved slots stay available for superuser roles.

Reproduced on PostgreSQL 16.14Verified 2026-07-16 (Docker lab, PostgreSQL 16.14)Verified against PostgreSQL 16.14 in an isolated lab environment

In 10 seconds

What triggers it
With max_connections = 100 and superuser_reserved_connections = 3 (both defaults), open 97 connections with a non-superuser role and hold them open.
Fix
Raise max_connections (requires a restart) if the application genuinely needs more concurrent connections.
Proof
Reproduced on PostgreSQL 16.14 → With every non-reserved connection slot (97 of 100, since 3 are reserved for superusers) held open by a non-superuser role, one more connection attempt with that role was rejected with SQLSTATE 53300.

Fix

What to do right now

Application-level steps for this error.

  • Raise max_connections (requires a restart) if the application genuinely needs more concurrent connections.
  • Put a connection pooler (e.g. PgBouncer) in front of PostgreSQL so application connections are reused instead of each request opening a new one.
  • Don't 'fix' this by lowering superuser_reserved_connections to 0, see the premium counterexample for exactly what that gives up.
Fix SQL
-- Prefer a pooler (PgBouncer/ODS) so apps reuse backends instead of opening one per request.
-- If you must raise the hard limit (requires restart):
--   ALTER SYSTEM SET max_connections = 200;
--   -- then restart PostgreSQL; pg_reload_conf() is not enough
-- Keep superuser_reserved_connections > 0 so admins can still connect when the pool is full.
SHOW max_connections;
SHOW superuser_reserved_connections;
SELECT count(*) AS current_connections FROM pg_stat_activity;

Verification

PG 16.14
Last verified
2026-07-16 (Docker lab, PostgreSQL 16.14)
Verification scope
Verified against PostgreSQL 16.14 in an isolated lab environment
Audit status
reviewed
ShareLinkedInX

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops