What is a Distributed Database?
A distributed database, told as a story about splitting one giant warehouse into regional branches that keep each other in sync. The deeper distributed-systems theory lives in the SRE field.
Every order nationwide piles onto one single warehouse.A far-away warehouse means slow delivery too.
Just copy everything to every branch, right?If two branches edit at once, the copies' counts drift apart.
A distributed database is a warehouse network split across branches.The nearest branch answers requests fast, yet from outside it looks like one warehouse.
Choosing centralized or distributed trades response speed against consistency.The cost of cross-branch joins belongs in that choice too.
Sharding, replication, and consensus are the basics of distributed DB modeling.Distributed-systems theory itself goes deeper in the SRE field.
A distributed database stores one logical database split across many nodes, using techniques like replication and consensus to make it look like a single database.
From a DB-modeling angle, this is about choosing a sharding key, picking sync vs. async replication, and the rising cost of cross-node joins and transactions. The deeper distributed-systems theory — CAP theorem, consensus algorithms — is covered in more depth over in the SRE field.
When grown-ups say it
- Sharding
- Splitting goods by branch. Choosing the split key is covered further in this same field. → splitting an overgrown warehouse into zones
- Replication
- Keeping a duplicate box at each branch. Covers sync vs. async replication. → the world of duplicate boxes
- Consensus
- Several branches voting on one answer. Covers algorithms like Raft/Paxos. → deciding by a vote among many
- CAP Theorem
- The law that three properties can't all be perfect at once. The consistency/availability/partition trade-off. → the law you can't have all three of at once
- Eventual Consistency
- Copies eventually match, even if a bit late. Copy counts can differ for a moment. → the story of eventually matching up
- Data Locality
- Handling a request at the nearest branch. The closer the branch, the faster the answer.
- Distributed Transaction (2PC)
- A transaction slip spanning several branches. The slip only finalizes once every branch agrees.
- NoSQL
- A warehouse without fixed shelf slots. Loosens the structure to make distribution easier.