SQL vs NoSQL Cheat Sheet

Choosing between SQL and NoSQL — ACID vs BASE, relational vs document vs key-value vs graph, decision framework.

Last Updated: May 1, 2025

Key Concepts

ItemDescription
OverviewThis cheat sheet covers essential concepts and best practices for this topic.
Best PracticesFollow industry standards and proven patterns for production systems.
Common PitfallsAvoid premature optimization and over-engineering without clear requirements.
Further ReadingConsult official documentation and system design references for deeper dives.

Quick Reference

ConceptWhen to Use
Horizontal ScalingAdd more machines — works for stateless services
Vertical ScalingBigger machine — simpler, hits hardware limits
CachingReduce latency for frequently accessed data
Async ProcessingDecouple services, handle spikes gracefully

Implementation Tips

ItemDescription
Start SimpleBegin with minimal viable architecture, iterate based on real bottlenecks
Measure FirstProfile before optimizing — do not guess where the bottleneck is
Design for FailureAssume everything will fail — build redundancy and graceful degradation
Document DecisionsRecord architecture decisions (ADRs) with context and tradeoffs

Key Tradeoffs

TradeoffOption AOption B
Consistency vs AvailabilityStrong consistency (CP)High availability (AP)
Performance vs DurabilityIn-memory (fast, volatile)Disk-backed (slower, durable)
Simplicity vs FlexibilityMonolith (simple)Microservices (flexible)
Cost vs SpeedServerless (pay-per-use)Provisioned (faster, predictable)
Pro Tip: The question is not which is better — it is which is better for THIS use case. Most large systems use both.