What is the difference between horizontal and vertical scaling of databases?

Answer

Vertical scaling (scale up) adds more resources to the existing database server — more CPU, RAM, faster storage. Simple to implement (no code changes needed), but has physical limits and creates a single point of failure. Works well for RDBMS since they are designed for single-server deployment. Horizontal scaling (scale out) adds more servers to distribute the load. For databases, this means replication (read scaling with replicas) or sharding (distributing rows across multiple servers). Horizontal scaling is complex — cross-shard queries, distributed transactions, and data consistency become challenges. NoSQL databases like Cassandra are designed for horizontal scaling from the ground up.