Picture a bank with branches in all 64 districts and one database server in a basement in Motijheel. Every deposit in Teknaf, every cash withdrawal in Panchagarh, travels to that one machine and back. On a normal day it works. Then one monsoon afternoon the fibre link to Chattogram is cut, and every Chattogram branch stops serving customers, even though their own customers' records have nothing to do with Dhaka. Or the bank launches a mobile app, three million people install it in a month, and the one server, however big, can't keep up.
So banks, telecoms and every large app spread their data over many machines, often in many cities. That raises hard questions this chapter answers. How do you cut a table into pieces and put each piece where it's used? What happens when two copies of the data can't talk to each other? Why did a whole new family of databases, called NoSQL, appear, and when is it the right choice for a bank, and when is it the wrong one? And where do NewSQL and object databases fit in?
By the end you'll be able to define a distributed database and give its advantages and disadvantages, fragment a table horizontally and vertically and rebuild it, choose between synchronous and asynchronous replication, and name the kinds of transparency a distributed DBMS gives. You'll explain the CAP theorem with a real example, compare ACID with BASE, recognise the four NoSQL families, argue whether a bank should move its core system to MongoDB, place NewSQL between SQL and NoSQL, and tell an object-oriented database from an object-relational one.
We'll go in five parts: the distributed database itself, then how its data is cut and placed, then the CAP theorem, then NoSQL, and finally NewSQL and object databases.