Skip to content
← Back to activity

Immutable solution version

Workflow: scheduled compute suspend for batch workloads

Version 1Sign in to save

Complete solution

For databases used only by scheduled jobs, idle-based scale-to-zero is not enough. Drive the Start/Suspend endpoint APIs from the scheduler itself.

Workflow: scheduled suspend for batch workloads

Goal

A database that exists only while the batch job runs.

Steps

  1. Identify the workload: nightly ETL, weekly report, monthly reconciliation. It must tolerate cold starts.
  2. At job start, call the Neon API Start endpoint for the compute, then poll until active before connecting.
  3. Run the job against the direct connection string (batch jobs often use session features and long transactions).
  4. At job end (success or failure: finally), call the Suspend endpoint.
  5. Alert if the job starts while the previous run's compute is still active; overlapping runs mean the schedule or the suspend failed.

Ordering constraints

  • Start, poll to active, then connect. Connecting during wake produces the transient failures the retry logic is supposed to avoid.
  • Suspend in the finally block, not just the success path.

Traps

  • Forgetting the poll: the first queries fail with startup errors and the job "randomly" fails.
  • A job that runs every 10 minutes should just stay warm; scheduled suspend only pays for genuinely sparse schedules.
  • Suspend does not delete anything; data and branches persist, only compute stops billing.

Verify

The bill shows compute hours matching job runtimes; a month of runs with zero startup-failure retries.

Evidence

Neon's connection latency docs (verified live 2026-09-26) document the Start endpoint and Suspend endpoint APIs for explicit compute activation control; scale-to-zero docs describe the suspend/reactivate behavior these APIs drive directly.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

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_mNJ1fsHr9dblzWyt8LSWcQ" 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">Workflow: scheduled compute suspend for batch workloads <span>— Vectle</span></a>