Fragmentation & Replication
Distribution has two basic moves: split the data or copy it. Fragmentation improves locality; replication improves availability.
In plain English
Split the books by city, or keep copies of the popular ones everywhere.
The one idea
Fragmentation partitions a relation; replication copies it. Both trade storage and coordination for locality and availability.
The physical distribution of rows determines which queries are local and which become expensive network joins.
By the end
- 01Distinguish horizontal and vertical fragmentation.
- 02Explain replication and its consistency cost.
- 03Know the trade-off between availability and consistency.
- 04Choose a distribution strategy for a workload.
Fragmentation
Horizontal fragmentation splits rows: customers in Europe go to one site, customers in Asia to another. Vertical fragmentation splits columns: frequently accessed columns stay together, large rarely used columns move elsewhere. A fragment must be reconstructible through union or join.
horizontal:
site A: customers where region = 'EU'
site B: customers where region = 'ASIA'
vertical:
site A: customer_id, name, email
site B: customer_id, profile_blobReplication
Replication stores copies of the same data at multiple sites. It improves read availability and reduces latency, but every write must be propagated. Synchronous replication keeps copies consistent at the cost of latency; asynchronous replication is faster but can serve stale data.
Choosing a strategy
Use fragmentation when access is naturally partitioned by region or attribute. Use replication when reads dominate and availability matters. Most systems combine both: fragment large tables and replicate small, read-heavy reference data.
Split by region, copy the catalog
Orders are written in three regions. Product categories are read everywhere and change rarely.
Horizontally fragment Orders by region.
Each site stores only its region's orders; local queries avoid the network.
Vertically fragment Customer into public and private columns.
Marketing reads the public fragment without access to sensitive fields.
Replicate the ProductCategory table to every site.
Reads are local, but an update must reach every replica.
ConclusionFragmentation is about where a row or column lives. Replication is about how many copies exist. They solve different problems and can be combined.
The trade-off
No free correctness.
Gain
Local reads, parallel processing, and availability.
Cost
Cross-site joins, replica consistency, and more complex failure handling.
Verdict
Fragment by access locality; replicate only data whose read/write ratio justifies the copies.
Recap
What to keep.
Takeaways
- +Horizontal fragmentation splits rows; vertical splits columns.
- +Fragments must be reconstructible.
- +Replication trades write cost for read availability.
- +Synchronous replication is consistent but slower.
- +Asynchronous replication is faster but may be stale.
Traps
- !Fragmenting without a way to reconstruct the original relation.
- !Assuming replication is free.
- !Ignoring write amplification under replication.
Focus
- →Give one horizontal and one vertical fragmentation example.
- →Compare synchronous and asynchronous replication.
- →Match a strategy to a read-heavy workload.
Check yourself
Before you turn the page.
What does horizontal fragmentation split?
What is the cost of synchronous replication?