# "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:
```sql
SELECT count(*) FROM pg_stat_activity WHERE datname = '[your-db]';
```
3. 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.