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).

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.

JobAWSAzureGoogle CloudDatabricksOpen source
App databasewhere an app keeps its own rowsRDS Postgres / DynamoDBAzure Database for PostgreSQL / Cosmos DBCloud SQL / FirestoreLakebase (Postgres)Postgres

Related ideas

Where it shows up

Part of the Walk level on these paths: Software Engineering (building services).