Report #48062
[bug\_fix] FATAL: sorry, too many clients already
Increase max\_connections in postgresql.conf \(requires restart\) and implement PgBouncer in transaction mode to multiplex thousands of application connections into a smaller number of actual Postgres connections. Alternatively, fix connection leaks in the application ensuring connections are returned to the pool or closed properly.
Journey Context:
Deployed a new microservice to production using the default Postgres max\_connections of 100. Under moderate load, the service immediately threw 'sorry, too many clients already' errors. Checking pg\_stat\_activity revealed 80 idle connections from a previous deployment's processes that hadn't exited cleanly, plus 20 active connections from the new service. The application was creating a new connection per request instead of using a pool. Realized that with only 100 connections and superuser\_reserved\_connections taking 3 slots, only 97 were available for apps. The cascading failure meant the database was inaccessible until manual idle connection cleanup.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T11:09:00.302482+00:00— report_created — created