VOOZH about

URL: https://thenewstack.io/databases-what-to-know-about-partitioning/

⇱ Databases: What to Know about Partitioning - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2023-02-28 04:00:26
Databases: What to Know about Partitioning
Data

Databases: What to Know about Partitioning

Sharding and partitioning are both about breaking up a larger database into smaller ones to increase performance based on specific needs.
Feb 28th, 2023 4:00am by Jessica Wachtel
👁 Featued image for: Databases: What to Know about Partitioning

Data is everything, everything is data, and in most cases, the data in databases keeps growing and growing, but the user experience must remain unaffected. How can that be? One strategy that all other strategies are built on top of is to divide and conquer, aka partitioning.

Distributed database provider Cockroach Labs recently published a helpful  blog post — written by Senior Technical Content Marketer Charles Custer — that covers the basics of partitioning.

There are two types of partitioning. Vertical partitioning splits a table by machine capability. Horizontal scaling splits by row, bringing in the ability to add more servers, which is called sharding.

Sharding can greatly improve the performance of an application, but it requires quite a bit of engineering work to perform operations that would have been done more simply with a single database.

The Basics

What Is Database Partitioning?

Conceptually very simple, it means breaking a database into separate pieces, aka partitions. Separate partitions allow separate access, storage and management for each. The upside is a more scalable, performant application, but the challenge is that it can be tough engineering, expensive and time-consuming.

Types of Partitions

Though there are more than two, horizontal and vertical are the most common. This example includes a single table, but real-world examples are not as simple.

Here is the Before Table:

 👁 Image

Vertical Partition is a table split by columns with different columns stored on different partitions.

👁 Image

A use case for vertical partitioning is when different columns are used differently. If this example was from a real bank, then Partition 1 (username, city) would be relatively static and need fewer performant machines, but Partition 2 (balance) would require high-throughput, high-performance machines since balances are updated more regularly.

Horizontal Partition is a table split by rows with different ranges on different partitions

👁 Image

A use case example for horizontal partitioning is to partition tables to improve the performance of specific, frequently used queries against that data.

Sharding is the spreading of horizontal partitions across multiple servers.

Sharding is a common practice at companies with relational databases. Without sharding, the database is limited to vertical scaling alone, which is beneficial but limited. To introduce horizontal scaling, the database is split into horizontal partitions, now called shards, and those shards are split across multiple servers.

Numerous sharding strategies and architectures exist. Amazon Web Services has a great introductory resource to sharding.

Advantages of Partitioning

Scalability: Vertical scaling is great to a point, but eventually one server can only do so much. Partitioning introduces the ability to add servers and removes limitations on scaling.

Ability: One server means there’s a single point of failure, but partitioning solves that.

Performance: Performance improvements are completely customizable, but some examples are reduced latency by sharding based on user location, and reduced contention by dividing request load across multiple servers.

Sounds Great, What Are These Challenges You Speak Of?

Take a single-instance Postgres database linked to its production application (and some backups serving as safeties if the production database goes down). The engineering team foresees the coming performance limitations of their current configuration and draws up a plan to split the database into three active shards, each with two passive replica shards for backup. Phew.

But wait, there’s more… it’s not just a shard-and-done situation because now processes that might have been simple before need more work and consideration. Here are a few tasks:

  • Split the data and workload evenly among the shards; otherwise, there could be a disproportionate amount of queries overloading a shard.
  • Make sure application code routing queries from the application goes to the correct shard.
  • Support code for other systems interacting with the database (i.e., data pipelines or change feeds that send updates to analytics databases) will likely change once shards are created.
  • Once-simple procedures will likely now be complex with multiple shards involved (i.e., updating data that spans more than one shard).

Here’s an example of a sharded architecture:

👁 Image

The thing about sharding is that when new shards are added, all of the bullets listed above will need updating again. This may result in a better user experience, but maybe not a better engineering experience, depending on how you define a better engineering experience. The cost will go up, but storing data is expensive.

Conclusion

Sharding and partitioning are both about breaking up a larger database into essentially smaller databases to increase performance based on specific needs. What affects the data also affects the application at large. Distributed databases are great, but it’s no replacement for understanding what goes on under the hood, Custer said.

TRENDING STORIES
Jessica Wachtel is a developer marketing writer at InfluxData where she creates content that helps make the world of time series data more understandable and accessible. Jessica has a background in software development and technical journalism.
Read more from Jessica Wachtel
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.