SQL vs NoSQL: How to Choose
SQL vs NoSQL explained: data models, consistency, scaling, query flexibility and when to use relational, document, key-value, wide-column or graph databases.
Database replication explained: leader-follower, multi-leader and leaderless designs, sync vs async, replication lag, failover, quorums and conflict resolution.

Database replication means keeping copies of the same data on several machines. It protects against machine failure, lets you spread reads across replicas and puts data closer to users. There are three main designs: leader-follower, where one node takes writes and copies them to followers; multi-leader, where several nodes accept writes and sync with each other; and leaderless, where clients write to several replicas directly and use quorums. Each trades simplicity, consistency and availability differently.
Replication copies the whole dataset to each node; splitting data across nodes is sharding. Large systems usually do both: each shard is replicated.
One node, the leader (or primary), accepts all writes. It records changes in a log and streams them to followers (replicas), which apply them in the same order. Reads can go to the leader or to any follower.
This is the default for PostgreSQL streaming replication, MySQL replication and many managed databases, because it’s simple: there’s one place where writes happen, so there are no write conflicts.
Asynchronous followers are usually milliseconds behind, but lag can grow to seconds or more under load. Users then see odd behaviour:
When the leader fails, a follower is promoted. Automatic failover is fast but risky: if the old leader was only unreachable, you can end up with two leaders (split brain). Robust systems use a consensus-based coordinator or fencing to make sure only one leader accepts writes, and accept that recent asynchronous writes may be lost.
Several nodes, often one per region, accept writes and replicate to each other. Users write to their nearest leader, so writes stay fast even across continents, and each region keeps working if links between regions fail.
The price is write conflicts: two users edit the same record in different regions at the same time. Options include:
Popularised by Amazon’s Dynamo paper and used by Cassandra-style databases, leaderless systems let clients send each write to several replicas and read from several replicas.
With n replicas, a write must be confirmed by w of them and a read must query r of them. If w + r > n, every read overlaps with at least one replica holding the latest write. A common setting is n = 3, w = 2, r = 2. Background mechanisms repair divergence: read repair fixes stale replicas when a read notices them, and anti-entropy processes compare and sync replicas. Data placement typically uses consistent hashing.
| Leader-follower | Multi-leader | Leaderless | |
|---|---|---|---|
| Where writes go | One leader | Several leaders | Several replicas directly |
| Write conflicts | None | Must be resolved | Must be resolved |
| Write availability | Depends on leader and failover | High, per region | High, while a quorum is reachable |
| Consistency | Strong from leader; lag on followers | Eventual between leaders | Tunable via w and r |
| Complexity | Low | High | Medium to high |
| Typical use | Most applications | Multi-region apps, offline clients | Very high write availability |
These trade-offs are the practical face of the CAP theorem and PACELC: during a partition you choose between availability and consistency, and even without one, you trade latency against consistency.
Start with leader-follower: it covers most applications, especially with a synchronous or semi-synchronous standby for failover. Consider multi-leader only when you genuinely need writes in several regions, and leaderless when write availability matters more than simple consistency. The database you choose often decides for you; our SQL vs NoSQL guide covers the families.
No. Replication copies mistakes too: a bad delete is replicated in milliseconds. Keep separate backups with point-in-time recovery.
Usually well under a second on a healthy network, but it can grow under heavy writes or long-running queries on replicas. Monitor it and alert on it.
In leader-follower setups, no: replicas are read-only, and writes must go to the leader.
Every article is edited by a human and checked against our editorial policy. Spotted a mistake? Tell us.
SQL vs NoSQL explained: data models, consistency, scaling, query flexibility and when to use relational, document, key-value, wide-column or graph databases.
What database sharding is, when you need it, how to choose a shard key, range vs hash vs directory sharding, and the operational pain points to plan for.
How B-tree and LSM-tree storage engines work, why one favours reads and the other writes, write and read amplification, compaction and which databases use each.