सही database चुनना एक प्रमुख system-design निर्णय है — SQL (relational) और NoSQL प्रकारों (document, key-value, आदि) के बीच, data, access patterns, scale, और consistency आवश्यकताओं के आधार पर। अलग-अलग databases अलग-अलग requirements के लिए उपयुक्त होते हैं।
SQL बनाम NoSQL (मुख्य विकल्प)
SQL (relational: PostgreSQL, MySQL) → structured data, tables, relationships, ACID:
✓ strong consistency, complex queries/joins, transactions, well-defined schema
✓ for: relational data, transactions, complex queries (most traditional apps)
NOSQL → various non-relational models, flexible schema, often easier horizontal scaling:
→ DOCUMENT (MongoDB) → flexible JSON-like docs
→ KEY-VALUE (Redis, DynamoDB) → simple, fast lookups, caching
→ WIDE-COLUMN (Cassandra) → massive scale, high write throughput
→ GRAPH (Neo4j) → relationships/networks
✓ for: flexible schema, huge scale, specific access patterns, high throughput
