🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Databases Advanced

What is Database Sharding?

A horizontal scaling strategy that distributes data across multiple database servers based on a partition key.

Sharding splits a database into shards, each on a separate server. A shard key (e.g., user_id) determines which shard stores each row. This distributes both data and query load, enabling horizontal scaling beyond a single server's capacity.

Challenges include cross-shard queries (joins across shards), rebalancing shards as data grows, maintaining consistency, and choosing an effective shard key. Some databases support native sharding (MongoDB, CockroachDB). Often avoided until truly needed due to complexity.

Related Terms

Database Proxy
A middleware server that sits between applications and databases, providing connection pooling, load balancing, and query routing.
NoSQL
A category of databases that store data in non-tabular formats, optimized for specific data models and access patterns.
Database Backup
The process of creating copies of database data to protect against data loss from failures, corruption, or human error.
Database Connection Pooling
A technique that maintains a cache of database connections for reuse, reducing the overhead of creating new connections.
JOIN
An SQL operation that combines rows from two or more tables based on a related column between them.
Database Index Types
Different index structures (B-tree, Hash, GIN, GiST, BRIN) optimized for various query patterns and data types.
View All Databases Terms →