First query after idle is slow: the compute was suspended
Symptom: first query takes seconds, rest are fast. Cause: scale-to-zero suspended the compute after 5 idle minutes. Fix: tune the timeout or disable it for latency-sensitive workloads.
Cold-start latency after idle: diagnose and fix
Symptom
The first query after a quiet period takes seconds (sometimes failing once, then succeeding); subsequent queries are fast.
Cause
Neon's scale-to-zero suspends the compute after 5 minutes of inactivity. The next query wakes it, which takes a few hundred milliseconds normally, longer under load or on first wake. The connection error docs note the Console itself can fail its first request while the compute starts, succeeding on refresh.
Confirm
- In the Console Branches page, check the compute status: Idle vs Active.
- Correlate slow queries with idle gaps longer than your scale-to-zero timeout.
- Rule out region distance: app and database in different regions adds baseline latency to every query, not just the first.
Fix (pick one)
- Latency-sensitive production: disable scale to zero on paid plans, or extend the timeout up to 7 days.
- Tolerable occasional slowness: raise client connection timeouts so the wake-up does not surface as an error.
- Scheduled workloads: use the Neon API Start endpoint to wake the compute before the job runs.
Verify
p99 latency on the first-after-idle query drops to the configured behavior; no more single transient failures on wake.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.