Skip to content
Contents/CH 28
Distributed & Analytics/Advanced · 14 min

Distributed Databases

A distributed database looks like one system but stores data across many sites. Transparency hides the network; CAP theory explains why it cannot hide everything.

In plain English

Many libraries, one catalog. You do not care which building holds the book.

The one idea

A distributed database spreads data and processing across sites while presenting one logical database to the application.

Locality, scale, and availability are real, but coordination is not free. A network partition forces a choice between consistency and availability.

By the end

  1. 01Define a distributed database.
  2. 02Explain location, fragmentation, and replication transparency.
  3. 03State the CAP trade-off.
  4. 04Know the challenges of distributed transactions.
01

Transparency

Location transparency means users do not need to know which site stores a row. Fragmentation transparency means they do not need to know how a table is split. Replication transparency means they do not need to know how many copies exist. The DBMS rewrites queries and coordinates updates across sites.

02

CAP theorem

A distributed system cannot guarantee consistency, availability, and partition tolerance all at once. When the network partitions, a system must choose between rejecting requests to stay consistent or serving stale data to stay available. Real systems choose different points on that spectrum.

chapter-28.db
C + A: no partition tolerance
C + P: reject requests during a partition
A + P: serve potentially stale data
03

Distributed transactions

A transaction may touch multiple sites. Two-phase commit coordinates the sites: a prepare phase and a commit phase. If a participant fails, the coordinator must decide whether to commit or abort. Distributed transactions are powerful but expensive and fragile under network failures.

Worked example3 steps

Orders in two regions

Customers in Europe and Asia write orders. Each region has its own database site.

01

Fragment orders by region.

A European order is written locally; the common query still sees one Orders relation.

02

A global report joins European and Asian orders.

The optimizer must move data or ship partial aggregates across the network.

03

The link between regions fails.

Each site must decide whether to accept local writes or preserve a single consistent view.

ConclusionDistribution is a physical design choice with logical consequences. Transparency hides the location, not the trade-off.

The trade-off

No free correctness.

Gain

Local access, horizontal scale, and survival of a site failure.

Cost

Network latency, distributed commits, partial failure, and much harder debugging.

Verdict

Distribute only when locality, scale, or availability justifies the coordination cost.

Recap

What to keep.

Takeaways

  • +A distributed database spreads data across sites but presents one logical system.
  • +Transparency hides location, fragmentation, and replication.
  • +CAP forces a trade-off during network partitions.
  • +Two-phase commit coordinates distributed transactions.
  • +Distribution adds latency and failure modes.

Traps

  • !Assuming a distributed database is always more available.
  • !Forgetting that transparency is a logical illusion, not a physical one.
  • !Ignoring the cost of two-phase commit.

Focus

  • →Explain the three transparencies.
  • →State the CAP trade-off in one sentence.
  • →Trace two-phase commit at a high level.

Check yourself

Before you turn the page.

0 / 2 answered
01

What does location transparency hide?

02

What does CAP say a system must trade during a partition?

DB//COSMOS

A field manual for database systems: model the domain, normalize the facts, query the relations, and protect the result.

Edition 2026 · 32 chaptersTopic catalogInterview prep