Split a multi-tenant orders table across three Postgres servers. See a hash spread small tenants evenly and one giant tenant overload one shard, run a query that must ask every shard, and move a tenant to another shard first the careless way (one order is lost) and then the careful way, while a writer keeps writing.
Time40 minutes
StackPostgreSQL 16Ports 15460, 15461, 15462
MemoryAbout 160 MB
Before thisLab 25Consistent Hashing Ring with Virtu
Explain a shard and a shard key, and route rows with a hash.
Explain a hot shard and why a hash balances tenants but not load.
Explain scatter-gather and what it costs.
Do an online move with dual write, backfill, reconcile and cutover, and say why the order matters.
Before you start
Finish Lab 04 (SQL Basics with PostgreSQL) and Lab 25 (Consistent Hashing) first. You should know INSERT and SELECT and why hash % N moves keys. Docker Desktop and Python 3 are needed.