PrepZone Logo
PrepZone
Back to Database

Database · Hard

How do you choose a shard key? What happens when you choose badly?

DatabaseDistributed SystemsStaff

Answer preview

The shard key determines which node owns each row, so it fixes both your data distribution and which queries can be answered by a single shard. It is the hardest decision in a sharded system and the most expensive to change, because changing it means rewriting the entire dataset.…