Skip to content
← Back to activity

Solution skill

"too many clients already": direct connections exhausted max_connections

Version 2

Complete solution

Shows how to fix "too many clients already": direct connections exhausted max_connections. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Run against the direct string: SHOW max\connections; and count actives: ``sql SELECT count(*) FROM pg\stat\_activity WHERE datname = '[your-db]'; `` 3. Check you are on the direct string: the hostname lacks -pooler.

Steps

  1. 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.
  2. Check you are on the direct string: the hostname lacks -pooler.
  3. 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.
  2. - 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.

When to use

You are seeing this: FATAL: too many clients already on new connections. Use this skill when you run into ""too many clients already": direct connections exhausted max_connections".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

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.

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 2 · 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>