DEV Community

Cover image for Horizontal Scaling vs. Vertical Scaling for SQL: What's the Difference?

Horizontal Scaling vs. Vertical Scaling for SQL: What's the Difference?

When it comes to scaling databases, there are two approaches: vertical scaling and horizontal scaling.

Vertical Scaling

Vertical scaling is when you have a single database instance serve all transactions. If you need to serve more transactions, execute more operations, or store more data than your instance can handle, you have to grow your instance. You have to add (or in a lot of cases create new instances with) more vCPUs, more memory, and more storage.

Alt Text

Horizontal Scaling

Horizontal scaling is when you have several database instances – called nodes – serve transactions. If you need to serve more transactions, execute more operations, or store more data than your cluster can handle, you add more nodes.

Alt Text

Horizontal scaling removes one critical issue with vertical scaling. Max scale.

  • With vertical scaling, your ceiling when it comes to transactions, operations, and storage is determined by the biggest instance you can use. Once you start getting up to 96 or 128 vCPUs, you don’t have much headroom left. Your instance is going to run out of resources for the workloads you put it under.
  • With horizontal scaling, you can scale indefinitely. If your cluster can’t handle the load you are putting on it, you add more nodes.

Horizontal scaling is increasingly becoming a requirement for databases because it provides a lot of advantages to vertically scaled databases.

  • Scalability - Some use cases require scaling beyond what vertically scaled databases can support.
  • Resilience & HA - Horizontally scaled systems are resilient and generally support high availability requirements better than vertically scaled systems.
  • Multi-Cloud - Horizontal scaling can easily be done across cloud providers. So horizontally scaled databases are a natural fit for multi-cloud environments.
  • Geo Distribution - Similarly, horizontal scaling can easily be done across AZs and regions too. So it is a natural fit for geo-distributed requirements.

Horizontal Scaling is Difficult

Horizontally scaling is difficult though.

Sharding data across nodes is difficult. Achieving high availability is difficult. Handling distributed transactions is difficult. And synchronizing time across nodes is difficult.

Watch our on-demand webinar to learn more about how horizontal scaling

Watch our on-demand webinar, Distributed SQL Fundamentals: Horizontal Scaling, to learn more about horizontal scaling and how these difficult tasks are handled by a real-life, horizontally scalable database – YugabyteDB.

And... Sign up for Yugabyte Cloud

Whether you’re building an MVP or operating at massive scale, Yugabyte Cloud can make sure your application databases are always available and fast. Yugabyte Cloud scales with your product. You can add and remove nodes at will. So you’re never over-provisioned. Best of all, Yugabyte Cloud is easy to build with. It’s a drop-in replacement for Postgres.

Sign up for the Yugabyte Cloud Beta. It’s PostgreSQL reimagined for a cloud-native world.

Top comments (0)