CHEAT SHEET #03Quick Reference Architecture•5 min read
Cloud Database Decision Matrix & Trade-Offs Cheat Sheet
Systematic evaluation framework for choosing between Relational, Key-Value, Document, Columnar, Time-Series, and Vector databases.
FreeCheat SheetAWSArchitecture
Systematic evaluation framework for choosing between Relational, Key-Value, Document, Columnar, Time-Series, and Vector databases.
1. The Database Family Matrix
| Category | Typical Engines | Core Data Structure | Scaling Model | Optimal Use Cases |
|---|---|---|---|---|
| Relational (RDBMS) | PostgreSQL, MySQL, Aurora, CockroachDB | B+ Tree on Disk / Shared Storage | Scale-up (or distributed NewSQL) | Financial transactions, inventory, strict ACID schemas |
| Key-Value | DynamoDB, Redis, RocksDB, Aerospike | Hash Table / Inverted Memory Index | Horizontal consistent hash partition | Session store, user profiles, rate limiting counters |
| Document Store | MongoDB, Amazon DocumentDB, Couchbase | B-Tree / JSON BSON trees | Sharded document collections | Content management, product catalogs, dynamic schemas |
| Wide-Column (Columnar) | Apache Cassandra, ScyllaDB, Bigtable | LSM-Tree (Log-Structured Merge) | Masterless peer-to-peer ring | Massive write ingestion, clickstream analytics |
| Time-Series | InfluxDB, TimescaleDB, Amazon Timestream | Append-only delta-compressed chunks | Time-based partitioning & retention | IoT metrics, server health telemetry, stock tickers |
| Vector DB | Pinecone, Milvus, pgvector, OpenSearch | HNSW (Hierarchical Navigable Small World) | Sharded vector index partitions | LLM embeddings, similarity search, recommendation engines |
2. Storage Engine Mechanics: B+ Tree vs. LSM-Tree
Interactive Architecture DiagramSynthesizing vector architecture diagram...
| Dimension | B+ Tree Architecture | LSM-Tree Architecture |
|---|---|---|
| Write Cost | High: Random in-place disk page overwrites; write amplification. | Low: Sequential append-only writes to MemTable and WAL. |
| Read Cost | Low: Predictable O(log N) lookup; single leaf page read. | Moderate to High: Checks MemTable, Bloom filters, and multiple SSTables. |
| Compaction Overhead | None: Pages updated directly on disk. | High: Background merging of SSTables can cause periodic I/O latency spikes. |
| Space Amplification | Medium: Page fragmentation (typically 50-70% fill factor). | Low: SSTables are immutable and sequentially compressed. |
3. Database Selection Decision Tree
Interactive Architecture DiagramSynthesizing vector architecture diagram...
4. Replication & Consistency Cheat Sheet
CAP Theorem Realities
- CP (Consistency + Partition Tolerance): System refuses writes or halts if quorum cannot guarantee latest data (e.g., ZooKeeper, etcd, MongoDB single-primary).
- AP (Availability + Partition Tolerance): System accepts writes anywhere; replicas sync asynchronously, resulting in eventual consistency (e.g., DynamoDB, Cassandra).
Isolation Levels Ranked from Weakest to Strongest
- Read Uncommitted: Suffers from dirty reads, non-repeatable reads, and phantom reads.
- Read Committed: Default in PostgreSQL; queries see only committed snapshots.
- Repeatable Read: Guarantees snapshot consistency across a single transaction.
- Serializable: Strict two-phase locking (2PL) or SSI; eliminates write skew and phantom rows.