Skip to main content
InterviewHubPRO
Section Overview
Q47

Question 47 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

94%
SQL & Relational Databases (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

Database Sharding: Horizontal Partitioning Strategies.

senior LevelSystem DesignDatabases & SQL

In Simple Words: When a single database server exceeds CPU, RAM, or storage capacity, data is split across multiple independent database nodes:

  • Range-Based Sharding: Partitioning by ID or Date ranges (e.g. Shard 1: IDs 1-1M; Shard 2: IDs 1M-2M). Can cause write hotspots on the latest shard.
  • Hash-Based Sharding: Applying a hash function hash(user_id) % num_shards. Evenly distributes data, but adding new nodes requires reshuffling unless using Consistent Hashing.