Skip to main content

Choosing a Database - Worked Scenarios

Exam guide§2.2

The single most-tested database skill is scenario matching: read a workload and name one product. The decision chart gives the general path; this page walks it end-to-end on three realistic applications. The method is always the same two-step funnel, then a scale/consistency tiebreak:

  1. What kind of data? Structured (rows and columns), unstructured (images, audio, free text), or both. This picks the family - relational vs NoSQL. When an app mixes both, weigh which dominates; unstructured content usually points to NoSQL, but news or social text that gets processed into scores and keywords is really structured.
  2. What must the app prioritize? Throughput and latency for real-time interactions, scalability for surging load or large gen-AI indexes, cost, and specialized features like vector embeddings or similarity search.
  3. Read the tiebreak signals - global scale, strong consistency, HTAP, caching - to land on the exact product.

Scenario 1 - EdTech chatbot (Firestore)

Study Buddy is an AI-powered EdTech chatbot delivering a personalized learning experience. It must store diverse learning content (text, images, videos, quizzes, interactive exercises), manage student profiles and progress, stay responsive under high concurrency, absorb frequent content updates, and serve personalized recommendations.

What kind of data?Both structured + unstructuredWhich family?NoSQLWhat to prioritize?Scalability, flexibility, integrationsRecommended databaseFirestore
Study Buddy mixes structured student data with unstructured learning content, and needs a flexible schema that scales - a NoSQL document store. Firestore's flexible document model, autoscaling, efficient querying, and native Google Cloud integrations make it the fit.

Student profiles, quiz scores, learning paths, and progress are structured; the learning content itself is unstructured (text, images, video, interactive simulations). Because the content is diverse and evolving, a NoSQL document store beats a relational schema overall.

CompareWhy not AlloyDB, Memorystore, or Bigtable here
AlloyDBA relational service tuned for transactional and enterprise workloads - wrong for unstructured content and a flexible, evolving schema.
MemorystoreAn in-memory cache: not durable persistent storage for large volumes or complex queries.
BigtableA wide-column store for internet-scale analytics and operational workloads - more than this app's access pattern needs.

Scenario 2 - Real-time mobile game (Spanner)

A popular gaming company is building a mobile game with real-time multiplayer battles, a fluctuating in-game currency and item economy, player progression and achievements, and social features (friends, guilds, events).

What kind of data?Predominantly structuredWhich family?RelationalWhat to prioritize?Low latency, scalability, consistencyRecommended databaseSpanner
The game's core data - player info, currency and items, leaderboards, match history - is structured, and in-game transactions demand strong consistency and ACID. Real-time scale plus global consistency point to Spanner.

Chat logs and player-created content may be unstructured, but the core mechanics - player data, currency and items, friend lists and guilds, leaderboards, match history and stats - are structured, and in-game transactions need ACID guarantees. Spanner is globally distributed, horizontally scalable, strongly consistent, and highly available.

GotchaSingle-database fit vs cost optimization

You could split the workload - Spanner for core game data, Cloud SQL for less-critical data like player history - to optimize cost. But for a single database that meets every requirement, Spanner is the answer. Firestore (NoSQL) misses the strong-consistency need, and BigQuery is an analytics warehouse, not a low-latency transactional store.

Scenario 3 - Fintech analytics platform (AlloyDB)

MarketMind is a fintech platform offering real-time financial analysis, risk assessment, and investment predictions: it ingests massive market-data streams, runs predictive AI models, personalizes portfolio optimization, detects fraud in real time, and generates automated reports.

What kind of data?StructuredWhich family?RelationalWhat to prioritize?High throughput, scalability, AI/MLRecommended databaseAlloyDB
MarketMind runs on structured numerical, time-series, and categorical data - even news and social sentiment get processed into structured scores. It needs high throughput, scalability, and AI/ML integration, which is exactly AlloyDB's strength.

The functionality centers on structured data - numerical stock prices, time-series price movements, categorical company classifications. Unstructured inputs like news articles and social sentiment are processed into structured features (sentiment scores, extracted keywords) before the models use them. AlloyDB, especially with its AI capabilities, excels at predictive modeling, personalized portfolio optimization, fraud detection, and automated reporting.

CompareWhy not Bigtable, Memorystore, or BigQuery here
BigtableOffers limited SQL and is not built for complex financial analysis; its strong consistency across all rows can cap write scalability for a high-volume app.
MemorystoreIn-memory - data is lost on restart, unsuitable for persistent financial records.
BigQueryA warehouse for analytical queries, not the high transaction volume and frequent updates a trading platform generates.

Recap

DECISIONWhich database for the workload?

Match the data shape to the family first, then let the priority signals pick the product.

ScenarioData shapePrioritiesAnswer
EdTech chatbotBoth (mostly unstructured)Scale, flexibility, integrationsFirestore
Real-time gameMostly structuredLow latency, scale, consistencySpanner
Fintech analyticsStructuredThroughput, scale, AI/MLAlloyDB
Pick this when: classify data shape, then read the priority signals

Building a gen AI app on top of one of these? See Generative AI workloads for vector search and embedding selection.