🎁 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

Full-Text Search
A technique for searching natural language text in databases using word stemming, ranking, and relevance scoring.
Cursor
A database object that enables row-by-row processing of query results, useful for operations that cannot be done in bulk.
SQL
Structured Query Language — the standard language for managing and querying data in relational databases.
Query Optimization
The process of improving database query performance through indexing, query rewriting, and schema design techniques.
CTE (Common Table Expression)
A temporary named result set defined within a SQL statement using the WITH clause, improving query readability and enabling recursion.
Database Backup
The process of creating copies of database data to protect against data loss from failures, corruption, or human error.
View All Databases Terms →