🎁 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

NoSQL
A category of databases that store data in non-tabular formats, optimized for specific data models and access patterns.
Transaction
A sequence of database operations that are treated as a single unit — either all succeed or all are rolled back.
PostgreSQL
An advanced open-source relational database known for its reliability, feature richness, and standards compliance.
Time-Series Database
A database optimized for storing and querying timestamped data points like metrics, sensor readings, and event logs.
Replication
The process of copying and maintaining database data across multiple servers for redundancy, failover, and read scaling.
View
A virtual table defined by a SQL query that provides a simplified or restricted view of data from one or more tables.
View All Databases Terms →