53300: too_many_connections
PostgreSQLWhat does it mean?
The server reached the maximum number of concurrent connections allowed by max_connections; new connections cannot be accepted.
Why does it happen?
No connection pool or a wrongly sized one, connection leaks, applications opening many short-lived connections, or max_connections set below the workload.
How to fix it
Identify the connection sources: SELECT usename, state, COUNT(*) FROM pg_stat_activity GROUP BY 1,2. Terminate long-idle client connections in a targeted way (unfiltered mass termination affects every application and pool): SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE state = 'idle' AND backend_type = 'client backend' AND usename = 'app_user' AND state_change < now() - interval '10 minutes' AND pid <> pg_backend_pid(). The real fix is a connection pool such as PgBouncer. Increasing max_connections costs memory; prefer pooling. Connections reserved for superusers keep administrative access available.