# KodeKloud: Courses System Design: Database Sharding ## System Design: Database Sharding ### Why One Database Isn't Enough - [Course: System Design: Database Sharding](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/index.md): Practical beginner course teaching data partitioning techniques like sharding, hashing, consistent hashing, and bucketing with hands-on labs and Python examples for stable, scalable distribution and rebalancing - [Course Introduction](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Why-One-Database-Isnt-Enough/Course-Introduction/page.md): Practical beginner course teaching data partitioning techniques like sharding, hashing, consistent hashing, and bucketing with hands-on labs and Python examples for stable, scalable distribution and rebalancing - [When One Database Starts to Break](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Why-One-Database-Isnt-Enough/When-One-Database-Starts-to-Break/page.md): Explains when a single database becomes insufficient, symptoms like slow reads and writes, replica limits, and when to adopt sharding. ### Sharding Fundamentals - [What Sharding Actually Is](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Sharding-Fundamentals/What-Sharding-Actually-Is/page.md): Describes sharding as splitting rows across servers for horizontal scaling to increase write throughput and storage while addressing routing, balancing, re-sharding, and cross-shard query challenges. - [Split the Users Table](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Sharding-Fundamentals/Split-the-Users-Table/page.md): Guide to converting a PostgreSQL users table into a Citus distributed table with eight shards across two worker nodes using psql commands ### Shard Keys and Partitioning - [Choosing the Shard Key](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Shard-Keys-and-Partitioning/Choosing-the-Shard-Key/page.md): Guidance on choosing an effective database shard key, covering cardinality, distribution, query alignment, immutability, co-location, hashing, and resharding trade offs - [Hashing and the Four Ways to Split](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Shard-Keys-and-Partitioning/Hashing-and-the-Four-Ways-to-Split/page.md): Explains hashing and four sharding strategies (hash, range, directory, geographic), trade offs, routing options, and deterministic hashing practices for distributing keys across database shards. - [Pick a Shard Key](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Shard-Keys-and-Partitioning/Pick-a-Shard-Key/page.md): Guidance on choosing and testing shard keys in Citus to achieve even data distribution, evaluate candidates, redistribute tables, and troubleshoot shard size skew. ### Routing and Hot Shards - [Routing and the Celebrity Problem](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Routing-and-Hot-Shards/Routing-and-the-Celebrity-Problem/page.md): How routing maps user requests to database shards, how celebrity hotspots occur, and mitigations like dedicated shards, caching, salting, and resharding strategies - [Fix a Hot Shard](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Routing-and-Hot-Shards/Fix-a-Hot-Shard/page.md): Guide to reproduce and fix an overloaded shard by routing traffic, monitoring metrics, and applying fixes such as weight changes, scaling, or resharding. ### Resharding and Cross-Shard Queries - [Resharding and Consistent Hashing](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Resharding-and-Cross-Shard-Queries/Resharding-and-Consistent-Hashing/page.md): Explains how consistent hashing and virtual nodes enable scalable sharding with minimal data movement compared to modulo-based sharding - [Resharding With Fixed Buckets](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Resharding-and-Cross-Shard-Queries/Resharding-With-Fixed-Buckets/page.md): Explains the fixed-buckets resharding strategy where stable user-to-bucket hashing plus bucket-to-shard mapping enables predictable, low-cost resharding with minimal data movement and short cutover windows. - [Sharding Challenges Joins Across Shards](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Resharding-and-Cross-Shard-Queries/Sharding-Challenges-Joins-Across-Shards/page.md): Explains challenges and techniques for performing joins across database shards, comparing remote lookups, scatter/gather, and repartitioning, and recommending co-location, denormalization, or small table replication. - [Grow the Cluster](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Resharding-and-Cross-Shard-Queries/Grow-the-Cluster/page.md): How to add a Citus worker node, inspect and rebalance shards for even distribution, and run cross-shard joins ### Sharding in Practice - [How Real Databases Shard for You](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Sharding-in-Practice/How-Real-Databases-Shard-for-You/page.md): Explains how databases shard, comparing relational solutions like Vitess and Citus and NoSQL systems such as Cassandra, DynamoDB, and MongoDB, with shard key guidance and trade-offs. - [Which One and When to Shard at All](https://notes.kodekloud.com/docs/System-Design-Database-Sharding/Sharding-in-Practice/Which-One-and-When-to-Shard-at-All/page.md): Guidance on when to shard databases, recommended sharding solutions per engine, migration cautions, and application responsibilities for shard keys, routing, and scaling alternatives