You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Cloud Spanner is Google Cloud's globally distributed, strongly consistent, relational database service. It combines the structure and query capabilities of a traditional relational database with the horizontal scalability of a NoSQL system. Spanner is designed for mission-critical applications that require global distribution, strong consistency, and five-nines availability.
Cloud Spanner is a fully managed, horizontally scalable relational database that provides:
Spanner's secret weapon is TrueTime, a globally synchronised clock system based on GPS receivers and atomic clocks in every Google data centre. TrueTime gives Spanner a precise, bounded notion of time across the globe, enabling it to order transactions consistently without the performance penalty of traditional distributed locking.
Spanner automatically divides data into splits (chunks) based on the primary key. Each split is replicated across zones (and regions in multi-region configurations). As data grows, Spanner automatically reshards — adding or merging splits to balance load.
nam6 spans US regions, eur6 spans European regions).Spanner uses the primary key for data distribution. Choosing the right key structure is critical:
Spanner supports interleaved tables — a parent-child relationship where child rows are physically stored next to their parent row. This is powerful for read patterns that always access a parent and its children together:
CREATE TABLE Orders (
OrderId STRING(36) NOT NULL,
CustomerId STRING(36) NOT NULL,
OrderDate TIMESTAMP NOT NULL,
) PRIMARY KEY (OrderId);
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.