System Design Fundamentals
Back to Data and Communication

Database Sharding & Partitioning

Splitting one big DB into many smaller ones. The strategies (range, hash, geo) and what breaks at the join. FIND_VIDEO: search 'database sharding partitioning explained' — recommended channel: ByteByteGo / Hussein Nasser. Aim for 11 min or under.

12 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.
Loading progress...

Key moments

  1. Prioritizing Read Performance — Analyze application read-to-write traffic ratios to target scaling investments effectively.
  2. Easy Win Optimizations — Apply vertical scaling, indexing, strategic denormalization, and connection pooling for immediate performance gains.
  3. External Caching Strategies — Deploy in-memory caching systems to shield the primary database from repetitive read traffic.
  4. Database Replication Architecture — Configure master-replica clusters to isolate write workloads and distribute read requests across replicas.
  5. Horizontal Database Sharding — Partition database rows across distinct physical instances using calculated sharding keys to scale writes.
  6. Vertical Schema Partitioning — Separate wide table schemas into core and secondary tables to optimize memory buffer utilization.
  7. Architectural Trade-offs and NoSQL — Evaluate whether heavily sharded SQL architectures should be replaced with purpose-built NoSQL systems.
PDF notes

Frequently asked questions

Why should read scaling optimizations precede database sharding?

Web applications are predominantly read-heavy (around 95% reads), so caching and read replicas resolve bottlenecks with far lower operational complexity than write-focused sharding.

What causes a hot shard in a horizontally partitioned database?

A poorly chosen sharding key concentrates traffic from high-activity accounts or sequential ranges onto a single node, overwhelming it while others sit idle.

How does vertical partitioning differ from horizontal sharding?

Vertical partitioning splits a table's columns into distinct tables to reduce row size, whereas horizontal sharding splits a table's rows across physical database servers.

When is it better to migrate to NoSQL instead of sharding SQL?

When sharding, denormalization, and disabling joins strip away SQL's ACID guarantees, adopting NoSQL provides native horizontal scaling with upfront architectural trade-offs.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.