Chapter 6. Cloud Spanner: large-scale SQL
This chapter covers
- What is NewSQL?
- What is Spanner?
- Administrative interactions with Cloud Spanner
- Reading, writing, and querying data
- Interleaved tables, primary keys, and other advanced topics
So far we’ve looked at relational (SQL) databases and nonrelational (NoSQL) databases and learned about some of the trade-offs of each. SQL databases generally provide richer queries, strong consistency, and transactional semantics but have trouble handling massive amounts of traffic. NoSQL databases tend to trade some or all of these in exchange for horizontal scalability, which allows the system to easily handle more traffic by adding more machines to the cluster. Obviously, the choice you make between SQL and NoSQL will depend on your business needs, but wouldn’t it be nice if you didn’t have to make that choice?
What if you could have rich querying, transactional semantics, strong consistency, and horizontal scalability? These types of systems are sometimes referred to as NewSQL databases.
NewSQL databases look and act a lot like SQL databases, but they have the scaling properties of NoSQL databases. For example, a NewSQL database may require that data locality be expressed in the schema somehow, but you can still query your data using familiar SELECT * FROM ... syntax. Let’s explore a bit of Google’s history in this area and see what came out in an attempt to solve this problem.