Document, Cache and Choosing the Right GCP Database: Firestore, Memorystore, BigQuery and a Decision Guide

Google Cloud Platform Architect 55 min min read Updated: Nov 17, 2026 Intermediate
Document, Cache and Choosing the Right GCP Database: Firestore, Memorystore, BigQuery and a Decision Guide
Intermediate Topic 3 of 3

Firestore

  • A serverless NoSQL document database: data in documents (JSON-like) inside collections
  • Automatic scaling, multi-region replication, offline sync for mobile and web, real-time listeners
  • Supports ACID transactions, indexes (automatic single-field, custom composite) and security rules for direct client access
  • Great for user profiles, carts, chat, app settings, game state
python from google.cloud import firestore db = firestore.Client() db.collection("users").document("asha").set({"name": "Asha", "city": "Pune", "points": 120}) doc = db.collection("users").document("asha").get() print(doc.to_dict()) for u in db.collection("users").where("city", "==", "Pune").stream(): print(u.id, u.to_dict())
  • Model data around how you read it. Avoid deep joins. Duplicate small pieces if needed
  • Watch hot documents (very frequent writes to one document)
  • Choose Native mode for new projects

Memorystore

  • Managed in-memory stores: Redis (including Redis Cluster), Valkey and Memcached
  • Sub-millisecond reads. Use it as a cache, session store, rate limiter, leaderboard or queue
  • Has standard tier with replica and automatic failover for availability
  • Reached by private IP in your VPC
text Cache-aside pattern 1. App asks cache for key "product:42" 2. Hit → return it 3. Miss → read the database, store in cache with a TTL (for example 5 minutes), return it
bash gcloud redis instances create session-cache --region=asia-south1 --tier=STANDARD --size=2 --network=prod-vpc gcloud redis instances describe session-cache --region=asia-south1 --format="get(host,port)"

BigQuery Is Also a Database

  • BigQuery is the analytics data warehouse (next section). Use it for large analytical queries, not for many small transactions

The Big Decision Table

NeedChoose
Standard relational app, MySQL/PostgreSQL/SQL ServerCloud SQL
High-performance PostgreSQL, transactions and analytics togetherAlloyDB
Global relational, unlimited scale, strong consistencySpanner
Massive time series, IoT, key-based lookupsBigtable
Mobile and web app documents, real-time syncFirestore
Sub-millisecond cache or sessionsMemorystore
Analytics and reporting on huge dataBigQuery
Files, images, backupsCloud Storage
Graph relationshipsSpanner Graph or a partner graph database
Vector search for AIAlloyDB, Cloud SQL, Spanner or BigQuery vector search

Scenarios

ScenarioAnswer and reason
Global gaming leaderboard with strict ranking and paymentsSpanner for payments and Memorystore for fast leaderboard
Mobile chat app with offline modeFirestore for sync and offline support
Millions of sensors writing every secondBigtable for throughput, BigQuery for analysis
Lift-and-shift of a MySQL web appCloud SQL with HA and replicas
Product catalog search page needs speedCloud SQL or Firestore plus Memorystore cache
Daily sales reports for executivesBigQuery with Looker dashboards

Practice

  1. Write a Firestore document for a user and a query by city
  2. Draw the cache-aside flow for a product page
  3. Choose a database for five more scenarios you invent
  4. List three ways to migrate a MySQL database to Cloud SQL

Conclusion

Pick databases by data model, scale and access pattern: Cloud SQL and AlloyDB for relational apps, Spanner for global scale, Bigtable for key-based huge throughput, Firestore for documents, Memorystore for cache and BigQuery for analytics. Many systems use several together.

Quick Summary: Firestore; Memorystore; BigQuery; decision table; scenarios.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators