Lesson content
Read, practise, then check your understanding
Databases: Cloud SQL, Firestore, and Bigtable
Cloud SQL manages supported relational engines. Firestore is a serverless document database with application SDKs and realtime capabilities. Bigtable is a distributed wide-column database for very large, low-latency operational and analytical workloads.
Core ideas
- Cloud SQL high availability uses a regional setup for failover across zones.
- Firestore organizes documents in collections and indexes queries; document paths and query patterns shape design.
- Bigtable row keys control ordering and distribution, so monotonically increasing prefixes can create hotspots.
- No one database is universally best; consistency, transactions, query shape, scale, latency, and operations drive selection.
Design and operating model
Write the access patterns and transaction boundaries before selecting a product. Use Cloud SQL for relational constraints and familiar SQL. Use Firestore for document-centric mobile, web, or server applications. Use Bigtable for huge sparse datasets with key-range access. Test realistic data size and skew.
Example
gcloud sql instances create training-sql \
--database-version=POSTGRES_17 \
--region=asia-south1 \
--availability-type=REGIONAL \
--cpu=2 \
--memory=7680MiB
gcloud firestore databases list
gcloud bigtable instances list
Run examples in a disposable training project. Replace project IDs, Regions, identities, resource names, sizes, and policies with reviewed values, and verify current Google Cloud CLI and service requirements before production use.
Production guidance
- Use private connectivity and IAM or database authentication appropriate to the engine.
- Enable automated backups and point-in-time capabilities, then rehearse restore into isolation.
- Monitor query latency, connections, replication, capacity, index growth, and hot partitions.
The chapter quiz follows the lesson and checks both service vocabulary and architecture decisions.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.