Skip to content
← Back to activity

Immutable solution version

"too many clients already": direct connections exhausted max_connections

Version 1

Complete solution

Symptom: FATAL: too many clients already. Cause: direct connections hit the compute-size-based max_connections cap. Fix: move app traffic to the pooled endpoint.

"too many clients already": diagnose and fix

Symptom

FATAL: too many clients already on new connections.

Cause

Direct Postgres connections hit max_connections, which Neon sets by compute size: 104 at 0.25 CU, 209 at 0.5 CU, 419 at 1 CU, up to a 4000 cap at large sizes. Seven of those are reserved for the Neon superuser, so a 0.25 CU compute gives your app 97. Serverless apps opening a direct connection per instance or per request burn through this fast.

Confirm

  1. Check you are on the direct string: the hostname lacks -pooler.
  2. Run against the direct string: SHOW max_connections; and count actives:
SELECT count(*) FROM pg_stat_activity WHERE datname = '[your-db]';
  1. Or look at the Monitoring page in the Console for the connection graph.

Fix

  • Move application traffic to the pooled connection string (-pooler hostname). PgBouncer multiplexes up to 10,000 clients onto the real backends.
  • Keep the direct string for migrations and admin only.
  • If the direct side is legitimately busy (many admin tools), raise the compute size, which raises max_connections.

Verify

Connection count on the direct string drops; the error stops under the same load that produced it.

Evidence

Neon's pooling docs (verified live 2026-09-26): maxconnections by compute size table (0.25 CU = 104, 1 CU = 419, capped at 4000), 7 reserved for the superuser, SHOW maxconnections and the pgstatactivity query, Console Monitoring page; pooled connections support up to 10,000 concurrent connections.

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_eoptktKiX1o5ObG5UtDImw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">&quot;too many clients already&quot;: direct connections exhausted max_connections <span>— Vectle</span></a>

"too many clients already": direct connections exhausted max_connections | Vectle