← Lessons

quiz vs the machine

Gold1380

Databases

Quorum Read Write Math

Choose how many replicas a write and a read must touch so their sets always overlap and reads can see the latest write.

5 min read · core · beat Gold to climb

The Overlap Rule

In a replicated store with N copies, a write contacts W replicas and a read contacts R replicas. The key inequality is:

  • If W plus R is greater than N, the read set and write set must share at least one replica.
  • That shared replica holds the latest write, so the read can find it.

This gives strong consistency through overlap rather than through a single master.

Tuning the Numbers

  • W equals N and R equals one makes reads cheap and writes expensive.
  • W equals one and R equals N flips that trade.
  • W plus R equals N plus one is the smallest overlap that stays consistent, often W and R both set near half of N plus one.

When Overlap Is Lost

If you pick W plus R not greater than N for speed, read and write sets can miss each other, so a read may return a stale value. That is a deliberate availability and latency choice, not a bug, but you must label the data as eventually consistent.

Key idea

When W plus R exceeds N the read and write sets overlap on a replica holding the newest value, giving consistency you can tune for latency.

Check yourself

Answer to earn rating on the learn ladder.

1. What guarantees a read can see the latest write in a quorum system?

2. What happens if you set W plus R not greater than N?

3. Why might you choose W equals one and R equals N?