---
title: "How to Give Millions of Workflows Quality Sleep"
description: "DBOS workflow suspension lets a durable workflow that is sleeping or waiting for a notification (via `suspend=True` on `DBOS.recv` or `DBOS.sleep`) mark itself SUSPENDED in its database row, record a delay deadline and suspend key, and exit via a special exception, so it holds no thread, memory or queue slot."
url: "https://swe.quest/articles/how-to-give-millions-of-workflows-quality-sleep-805d64c372b7c24e"
canonical: "https://www.dbos.dev/blog/workflow-suspend"
source: "DBOS"
published: "2026-11-18"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 4
tags: ["scheduling","postgres","python"]
---

# How to Give Millions of Workflows Quality Sleep

A post on [DBOS](https://swe.quest/sources/dbos.md), published 2026-11-18, 4 min read, Deep dive. Original: [https://www.dbos.dev/blog/workflow-suspend](https://www.dbos.dev/blog/workflow-suspend)

## Summary

DBOS workflow suspension lets a durable workflow that is sleeping or waiting for a notification (via \`suspend=True\` on \`DBOS.recv\` or \`DBOS.sleep\`) mark itself SUSPENDED in its database row, record a delay deadline and suspend key, and exit via a special exception, so it holds no thread, memory or queue slot. Timeouts are resumed by a background poller that reads only the front of an index on the delay-deadline column and clears deadlines after waking workflows, keeping the index small. Notifications are handled in \`DBOS.send\`, which sets a matching suspended workflow's deadline to 0 so the poller wakes it immediately; a transactional check before suspending avoids races. Woken workflows are re-enqueued and resume from checkpoints exactly as in crash recovery, which lets millions of long-waiting workflows coexist cheaply.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Scheduling](https://swe.quest/tags/scheduling.md) (Distributed systems)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- durable execution
- database indexes ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

DBOS, durable execution, workflow suspension, PostgreSQL

## Related posts

- [Running Durable Workflows in Postgres using DBOS](https://swe.quest/articles/running-durable-workflows-in-postgres-using-dbos-758f463809fa3e9f.md): Supabase · 2024-12-10 · Medium · 4 min read · PostgreSQL, Scheduling, Resilience, Serverless
  DBOS implements durable workflows entirely in Postgres: workflow and step decorators record a workflow's ID, inputs and status in a workflow\_status table and each step's output in operation\_outputs, all within a separate system database.
- [How We Oops-Proofed Infrastructure Deletion on Railway](https://swe.quest/articles/how-we-oops-proofed-infrastructure-deletion-on-railway-29c48b4679aeb3a6.md): Railway · 2025-08-28 · Medium · 9 min read · Scheduling, Storage systems, Resilience, TypeScript
  Railway now gives deleted persistent volumes a 48-hour grace period during which deletion can be undone, built on Temporal durable workflows.
- [Durable and auditable workflows with DBOS and ClickHouse Managed Postgres](https://swe.quest/articles/durable-and-auditable-workflows-with-dbos-and-clickhouse-managed-postgres-84b2cf91df44a544.md): ClickHouse · 2026-11-24 · Medium · 6 min read · Event-driven architecture, PostgreSQL, Analytics & OLAP, Scheduling, Python
  DBOS, an open-source Postgres-native durable execution library, stores workflow and step checkpoints, queues and schedules in Postgres so crashed processes resume from the last completed step without a separate orchestrator.
- [Building Workflows, Part 2 – the executor and evaluation](https://swe.quest/articles/building-workflows-part-2-the-executor-and-evaluation-b966efc6ca5866f8.md): incident.io · 2022-09-14 · Medium · 19 min read · PostgreSQL, Scheduling, Queues & messaging, System design, Go
  incident.io's workflow executor listens for trigger events, evaluates workflow conditions against a scope, and creates a workflow run before executing steps.
- [Incident Report: February 11, 2026](https://swe.quest/articles/incident-report-february-11-2026-97407fb1f3ed5567.md): Railway · 2026-02-11 · Medium · 3 min read · Incidents & postmortems, Threat detection, Deployment
  A new automated anti-fraud ruleset at Railway used overly broad workload-fingerprinting criteria.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
