0
0
HLDsystem_design~3 mins

Why Database sharding strategies in HLD? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if your favorite app suddenly slowed down because its database was too big to handle?

The Scenario

Imagine a small online store that keeps all its customer and order data in one big database. As the store grows, more people visit and buy things at the same time. The database starts to slow down, making the website lag and frustrating customers.

The Problem

Trying to handle all data in one place becomes slow and risky. The database can get overwhelmed, causing delays and crashes. Fixing this by adding more power to one machine is expensive and has limits. Also, backups and maintenance become harder and take longer.

The Solution

Database sharding splits the big database into smaller, faster pieces called shards. Each shard holds part of the data, so many servers can work together smoothly. This way, the system can handle more users and data without slowing down or breaking.

Before vs After
Before
SELECT * FROM orders WHERE customer_id = 123;
After
SELECT * FROM orders_shard_3 WHERE customer_id = 123;
What It Enables

It makes huge databases fast and reliable by spreading the load across many servers.

Real Life Example

Big social media platforms use sharding to store billions of user profiles and posts, so millions of people can use the app at the same time without delays.

Key Takeaways

One big database slows down as data grows.

Sharding splits data into smaller parts for speed and reliability.

It helps systems handle many users and large data smoothly.