SQL vs NoSQL Differences
Q: SQL vs NoSQL - why is it difficult to scale SQL, and when would you pick each? A: SQL (relational) databases enforce a fixed schema and strong ACID transactions, and typically scale vertically or via complex sharding/replication because joins and multi-row transactions don't naturally distribute across nodes without added complexity (distributed transactions, cross-shard joins). NoSQL databases (document, key-value, wide-column, graph) trade some consistency/relational structure for horizontal scalability, flexible schemas, and high write throughput, often adopting eventual consistency (per the CAP theorem, favoring Availability/Partition-tolerance over strict Consistency). Choose SQL when strong consistency, complex relationships/joins, and transactional integrity matter (e.g., financial ledgers); choose NoSQL when you need to scale horizontally, have flexible/evolving schemas, or extremely high write/read throughput with simpler access patterns (e.g., session stores, catalogs, event logs).