Article: Implementing Durable Workflows on Postgres Without an External Orchestrator

Raman Varma ยท rss ยท 2026-09-14 Reader ๐Ÿ–ฅ๏ธ

Cascading Failure & System Resilience PatternsDurable Execution & Workflow CheckpointingLong-Running & Managed AgentsSoftware Design FundamentalsSRE & Incident Response
Durable workflow execution is fundamentally a database-checkpointing problem, so a team that already operates a relational database like Postgres at scale can implement production-grade durable execution โ€” concurrent dispatch, idempotency, crash recovery, durable waits, and observability โ€” as a handful of well-understood SQL primitives, without deploying a separate stateful orchestrator such as Temporal or AWS Step Functions.

practical ยท mixed โ€” Practical: the piece argues for a specific engineering decision (build durable workflow execution on Postgres instead of adopting an external orchestrator like Temporal). Form is mixed โ€” expository technical walkthrough (schemas, SQL, code) carrying an argumentative case, opened and closed by narrative framing from the author's own system (Kestrel Workflows).

Structure

PartRole
Opening: the Kestrel Workflows origin story and the autosave analogycontext
"The Default: Using an External Orchestrator" โ€” describes the standard orchestrator model and enumerates its costs (stateful single point of failure, own access-control surface, KV data model resists relational analysis)counter-position, set up to be rejected
"Postgres as the Orchestrator" โ€” the workflow_executions table and the core reframing (durable execution is a checkpointing problem, and we already have a checkpoint store)thesis statement / pivot
"One Clause That Makes Everything Safe" (SKIP LOCKED) โ€” concurrent dispatch without a broker or leader electionevidence (technique 1: concurrency)
"Let the Database Enforce Idempotency" โ€” unique-constraint checkpoint tableevidence (technique 2: idempotency)
"Crash Recovery: Leases and a Sweeper"evidence (technique 3: fault tolerance)
"Durable Sleeps and Human Approvals" โ€” waits as rows with wake_atevidence (technique 4: long/arbitrary waits at constant cost)
"Why This Scales" โ€” throughput/availability claims, and an explicit scope limit (favor Temporal for sub-millisecond, thousands-of-workers fan-out)rebuttal to an anticipated objection, with a conceded boundary condition
"Operational Considerations" โ€” connection pressure/PgBouncer, dead-tuple bloat/autovacuum/partitioninghonest caveats / operational cost
"Observability for Free" and "Reliability and Security Collapse to One Dependency"conclusion, restating the unity in benefit terms

Key terms

Propositions

Arguments

A relational database a team already operates (Postgres) is a viable, and for a defined class of workloads a superior, alternative to a dedicated external orchestrator for durable workflow execution. strength: high
Explicit premises:
Implicit premises:
Inferences:
Aggressive, short lease durations are safe to use because checkpoints are idempotent. strength: medium
Explicit premises:
Implicit premises:
Inferences:

Narratives

Questions addressed

Gaps

Closes gaps elsewhere

Related documents