๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout 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

SQL
Structured Query Language โ€” the standard language for managing and querying data in relational databases.
Materialized View
A database object that stores the precomputed result of a query, offering faster reads at the cost of periodic refresh.
Database Proxy
A middleware server that sits between applications and databases, providing connection pooling, load balancing, and query routing.
Index
A data structure that improves the speed of data retrieval operations on database tables at the cost of additional storage.
Replication
The process of copying and maintaining database data across multiple servers for redundancy, failover, and read scaling.
Transaction
A sequence of database operations that are treated as a single unit โ€” either all succeed or all are rolled back.
View All Databases Terms โ†’