Running Durable Workflows in Postgres using DBOS
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. On restart, a background thread re-runs PENDING workflows with their original inputs and skips steps whose outputs are already stored, so execution resumes from the last completed step. This relies on workflows being deterministic. Because a step transition is a ~1ms Postgres write rather than a ~100ms external dispatch, DBOS claims 25x the speed of AWS Step Functions, and it offers exactly-once transactional steps and idempotency keys used as workflow IDs.
Related posts
- Durable and auditable workflows with DBOS and ClickHouse Managed Postgres
ClickHouse mediumAdept
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. The walkthrough runs the DBOS Python starter app against ClickHouse Managed Postgres, then uses WalShadow (private preview) to replicate the dbos schema from the Postgres WAL into ClickHouse. With WalShadow's soft-delete setting, deletions arrive as tombstone rows (_is_deleted = 1, _commit_ts) in a ReplacingMergeTree. That lets teams keep short retention in Postgres (e.g., seven days) while holding years of auditable workflow history in ClickHouse.
- Building Workflows, Part 2 – the executor and evaluation
incident.io mediumAdeptincident.io's workflow executor listens for trigger events, evaluates workflow conditions against a scope, and creates a workflow run before executing steps. A broad 'incident-updated' trigger fixes ordering problems with multi-condition workflows. A 'once-for' column backed by a Postgres unique index provides cheap, consistent idempotency, so trigger consumers can be retried safely. To cope with Google Pub/Sub's at-least-once delivery, execution proceeds one step at a time under a SELECT FOR UPDATE row lock, with a JSON progress column recording completed steps. Runs therefore behave serially, resume after crashes without repeating steps, and double as a customer-facing audit log.
- Workflows are coming to Supabase
Supabase mediumAdeptSupabase is building Workflows, an open source orchestration engine written in Elixir that uses the Amazon States Language to coordinate existing functions (AWS, GCP, Azure, OpenFaaS, Postgres) in response to database events or HTTP calls. Jobs, queues and logs are stored in Postgres via Oban. Workflows can be persistent, surviving restarts, or transient and in-memory. A worked example shows a state machine that maps over Realtime INSERT events on a users table, waits 86400 seconds, then sends a templated welcome email. The interpreter is already open sourced on Hex, with dashboard integration and a Zapier-like UI planned.
- Production Postgres on Railway: From First Deploy to High Availability
Railway mediumAdeptRailway Postgres can grow from a single private-networked database to a production setup with volume backups, point-in-time recovery, PgBouncer connection pooling and Patroni-based high availability, demonstrated with an orders API that uses idempotency keys so retries stay safe. PITR restores into a separate service for validation, and the guide stresses measuring RPO/RTO end to end, including validation and reconnection time. Transaction pooling breaks session settings, LISTEN, advisory locks and named prepared statements, so migrations should use an unpooled URL. In one small planned switchover test (primary, two replicas, etcd, HAProxy), writes were interrupted for about 17 seconds. That is a single observation, not a guaranteed failover time.
- Managed Postgres on Railway
Railway mediumAdeptRailway's managed Postgres now covers the full database lifecycle: private-by-default services with reference-variable credentials, usage-billed vertical scaling, live volume resizing, and one-click PgBouncer pooling with a separate unpooled URL for migrations. HA conversion turns an existing node into the primary of a Patroni-managed streaming-replica cluster with etcd for leader election and HAProxy for routing, so apps keep the same endpoint through failover but still need reconnect/retry logic. Point-in-time recovery uses pgBackRest with continuous WAL archiving (weekly full, daily differential, ~4 weeks retention) and restores into a separate service. Automatic image updates, CVE patching, guided pg_upgrade major upgrades with compatibility checks, pg_stat_statements-based query statistics, and CLI/MCP agent workflows round out the platform.