๐ŸŽ 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

EXPLAIN Plan
A database command that shows how the query planner will execute a SQL query, revealing join methods, scan types, and estimated costs.
Data Warehouse
A centralized repository optimized for analytical queries that integrates data from multiple operational sources.
Redis
An open-source, in-memory data store used as a database, cache, message broker, and queue with sub-millisecond response times.
EXPLAIN ANALYZE
A PostgreSQL command that shows the execution plan of a query along with actual runtime statistics for performance tuning.
ACID
A set of four properties (Atomicity, Consistency, Isolation, Durability) that guarantee reliable database transactions.
Database Connection Pooling
A technique that maintains a cache of database connections for reuse, reducing the overhead of creating new connections.
View All Databases Terms โ†’