Postgres transactions are a distributed systems superpower
The article explains how co-locating workflow state with application data in Postgres enables reliable distributed systems by leveraging database transactions and atomicity. This approach simplifies coordination, making workflows more robust and consistent without relying on external state management.
Background
- **DBOS (Database-Oriented Operating System)** is an open-source project that implements application workflows entirely inside PostgreSQL, treating the database as the operating system rather than just a persistence layer.
- Traditional cloud apps store workflow state externally (e.g., in Redis or S3), which creates consistency problems — if a step crashes mid-way, you must manually reconcile state and transactions.
- The "superpower" described is using native Postgres transactions (ACID guarantees) to co-locate workflow state with application data inside the same database. This means a crash cannot leave state half-updated, eliminating the need for complex recovery logic.
- The idea builds on **foundational database concepts** (two-phase commit, MVCC, row-level locking) but applies them to application orchestration — a shift from "database as a dumb store" to "database as the coordinator."
- **Why it matters**: As cloud architectures grow more complex, developers spend substantial effort on idempotency, retries, and distributed state management. DBOS argues this should be handled by the database itself, simplifying backend code and reducing bugs.