liveBook · Manning

Consistency

As explained in PostgreSQL Mistakes and How to Avoid Them

Consistency is a distributed-system guarantee that reads return the most recent data or report an error.

Consistency guarantees that reads return the most recent data or report an error. Distributed designs trade it against availability, partition tolerance, and low latency. section 5.5

Multi-master PostgreSQL makes the tradeoff concrete:

  • Independent database instances can replicate in both directions, but shared writes can collide rather than behave like one coordinated database. section 5.5

A replicated ticket insert fails

After both nodes contain tickets 1–3, inserting a fourth ticket on the other node fails because its generated identity reuses an existing key. The conflict demonstrates why multi-master availability requires consistency compromises. section 5.5

How PostgreSQL Mistakes and How to Avoid Them covers it

How deep it goes
Defines the guarantee and demonstrates replication conflicts, but stops short of detailing a complete conflict-resolution strategy.
Examples
Uses bidirectional PostgreSQL ticket replication, duplicate identities, and a renamed replicated column to expose inconsistency.
What you can do after
Evaluate distributed database designs by identifying when availability or low latency compromises consistent reads and writes.
How it connects
Connects consistency with availability, partition tolerance, latency, CAP, PACELC, PostgreSQL, and logical replication.

Also explained in

Compare how 20 books explain consistency →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of PostgreSQL Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.