Sharding Pinterest: How we scaled our MySQL fleet
Pinterest Engineering

Great Article. But how do you manage referential integrity?

Suppose for the table board_has_pins in a particular shard, how do you enforce that the pin_ids and board_ids for the rows in that table represent pins and boards which are there in some shard?

If you are checking this at the application layer, how do you manage the case where when you are creating a board_has_pins row in a particular shard the pin which represents the pin_id in the row is being deleted (the pin existed when you checked at the application layer).

Show your support

Clapping shows how much you appreciated Samir Ahmed’s story.