# 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
1. In the Console Branches page, check the compute status: Idle vs Active.
2. Correlate slow queries with idle gaps longer than your scale-to-zero timeout.
3. 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.