Sharding & Partitioning

Shard by user id

A messaging product stores billions of rows. Every query is “messages for user U” or “send as user U.” One Postgres primary is maxed on disk and writes. How do you shard, what is the partition key, and how does one read route to a single shard?

Intermediate drill question.

Write it as you would say it in the interview: assumptions, the design, tradeoffs, and what you would do next. The draft saves in this browser.

Review the lesson