1. Data Storage Decision Framework
Start with access patterns, not product names. Walk this flowchart for every data requirement:
2. Decision Axes
| Axis | Key Question | Impact |
|---|---|---|
| Data Model | Relational / document / key-value / graph? | Dictates service family |
| Consistency | Strong ACID or eventual OK? | Strong → SQL; Eventual → Cosmos DB |
| Scale | GBs, TBs, or PBs? | PB-scale → Data Lake Gen2 |
| Query Complexity | Multi-table joins / aggregations? | Complex → Azure SQL / PostgreSQL |
| Global Distribution | Multi-region writes needed? | Yes → Cosmos DB (only turnkey option) |
| Cost Sensitivity | Budget-constrained? | Table Storage cheapest; Cosmos DB premium |
3. Service Comparison Matrix
| Service | Data Model | Max Scale | Consistency | Latency | Cost Tier | Best For |
|---|---|---|---|---|---|---|
| Azure SQL | Relational | 100 TB | Strong (ACID) | ~2-5 ms | $$–$$$ | OLTP, complex queries |
| Cosmos DB | Multi-model | Unlimited | 5 levels (tunable) | <10 ms (P99) | $$$ | Global, low-latency |
| PostgreSQL Flex | Relational | 16 TB | Strong (ACID) | ~2-5 ms | $$ | OSS compatibility |
| MySQL Flex | Relational | 16 TB | Strong (ACID) | ~2-5 ms | $$ | LAMP / WordPress |
| Table Storage | Key-value | 500 TB | Strong (per-entity) | ~5-10 ms | $ | Simple lookups, IoT |
| Blob Storage | Unstructured | 5 PB per account | Strong | ~10-50 ms | $ | Files, backups, media |
| Data Lake Gen2 | Hierarchical files | 5 PB per account | Strong | ~10-50 ms | $ | Big data analytics |
| Redis Cache | In-memory KV | 120 GB (clustered TBs) | Eventual | <1 ms | $$–$$$ | Caching, sessions |
4. Workload Archetypes
- OLTP with complex queries → Azure SQL Database — joins, stored procs, strong consistency
- Global low-latency document/key-value → Cosmos DB — multi-region writes, guaranteed <10 ms
- Open-source compatibility → PostgreSQL Flexible Server — extensions, pgvector, no vendor lock-in
- Unstructured files / media → Blob Storage — tiered (Hot/Cool/Archive), CDN-friendly
- Big data / analytics pipeline → Data Lake Gen2 — hierarchical namespace, Spark/Synapse integration
- Session state / caching → Azure Cache for Redis — sub-ms reads, pub/sub, distributed locks
- Simple key-value (budget) → Table Storage or Cosmos DB Table API — cheapest structured option
5. Polyglot Persistence
Modern architectures use multiple data stores — each optimized for its access pattern. This is polyglot persistence:
- Benefit: Each service operates at its optimal cost/performance point
- Trade-off: Increased operational complexity, eventual consistency between stores
- Mitigation: Use managed services (reduce ops), event-driven sync (Change Feed, Event Grid)
6. Real-World: E-Commerce with 4 Data Stores
Scenario: Contoso Commerce serves 2M users across 3 continents. Their architecture uses four data stores:
| Data Domain | Access Pattern | Chosen Service | Rationale |
|---|---|---|---|
| Orders & Inventory | Complex joins, ACID transactions | Azure SQL (Business Critical) | Referential integrity, stored procs |
| Product Catalog | Global reads, flexible schema | Cosmos DB (Session consistency) | Multi-region, <5 ms reads worldwide |
| User Sessions | Sub-ms reads, 30-min TTL | Azure Cache for Redis (P1) | In-memory speed, auto-expiry |
| Product Images | Large blobs, CDN-served | Blob Storage (Hot) + CDN | Cheapest per-GB, lifecycle policies |
Sync Pattern: Order events publish to Event Grid → Cosmos DB Change Feed updates catalog availability → Redis cache invalidated via pub/sub.
Result: P99 latency <50 ms globally, 60% storage cost reduction vs. all-SQL approach.
7. Exam Tip
- "Global distribution" or "multi-region writes" → only Cosmos DB provides turnkey multi-master
- "Complex joins across tables" → Cosmos DB is wrong; choose Azure SQL or PostgreSQL
- "Lowest cost for simple key-value" → Table Storage, not Cosmos DB (unless global needed)
- "Sub-millisecond reads" → Redis Cache, not any disk-based store
8. Knowledge Check
Q1: An application requires multi-region writes with guaranteed <10 ms latency for document reads. Which service?
Q2: A financial application needs complex multi-table joins with strict ACID transactions. Which service?
Q3: An IoT solution stores billions of simple key-value telemetry records. Cost is the primary concern. Which service?
Q4: Which pattern describes using multiple specialized data stores within a single application architecture?