Database Sharding
📑 10 slides
👁 29 views
📅 1/30/2026
Database Sharding
Scaling Databases for Large Applications
2
What is Database Sharding?
- Breaking one big database and distributing it across multiple servers
- Each shard operates independently, improving efficiency
- Commonly used in large-scale applications to handle high traffic
3
Why is Sharding Used?
- Handles very large datasets that exceed single server capacity
- Reduces server load and improves query response times
- Enables scalability for growing user bases and data volumes
4
What is a Shard?
- A small, independent part of a database with subset of data
- Example: Student database split by roll number ranges
- Each shard functions as a separate database instance
5
Types of Database Sharding
- Horizontal: Dividing table rows across servers
- Vertical: Splitting table columns across servers
- Hash-based: Using algorithms to distribute data automatically
6
Horizontal Sharding
- Most common sharding approach for large datasets
- Same table structure replicated across servers with different rows
- Example: Students divided by city across multiple servers
7
Vertical Sharding
- Divides database by columns rather than rows
- Different attributes stored on separate servers
- Example: Student names on one server, grades on another
8
Hash-Based Sharding
- Uses mathematical functions to distribute data evenly
- Automatically assigns data to shards without manual rules
- Example: StudentID modulo operation determines shard location
9
Advantages of Sharding
- Significantly improves database performance and speed
- Enables better load balancing across multiple servers
- Provides nearly unlimited scalability for growing data needs
10
Disadvantages of Sharding
- Increases system complexity and maintenance overhead
- Joins across shards require special implementation
- Backup and recovery processes become more challenging
1 / 10