Home › Key concepts › Transactions and consistency
Key concept · Walk (intermediate) · the same on every platform
Transactions and consistency
Either all of a change happens, or none of it does.
What it is
A database transaction groups several writes so they succeed or fail together. Across separate services there is no single transaction, so systems use patterns such as the outbox (write the change and the message to send in one transaction).
See it happen: Problem Lab: two writers, a lost update, and optimistic concurrency (simulation), recorded from a real run.
Why it matters
Half-done changes are the source of the worst bugs: money taken but no order, or an order with no payment.
An example
Debit one account and credit another in one transaction, so money is never lost in between.
The common mistake
Writing to the database and then sending a message separately, and losing the message when the process crashes in between.
Where you meet it on each platform
The idea stays the same; only the product name changes.
| Job | AWS | Azure | Google Cloud | Databricks | Open source |
|---|---|---|---|---|---|
| App databasewhere an app keeps its own rows | RDS Postgres / DynamoDB | Azure Database for PostgreSQL / Cosmos DB | Cloud SQL / Firestore | Lakebase (Postgres) | Postgres |
Related ideas
Where it shows up
Part of the Walk level on these paths: Software Engineering (building services).