- In distributed partitioning (NOT A TEXTBOOK SHARDING), performance relies upon choosing a right "shard key"
- Shard key, can be considered as a property chosen to partition (distribute data), that would benefit most of our queries!
- For example:
- Table with zipcode, or cities as partitioning property, because most often, queries would hit a "single shard" or in a true sense, "single foreign partition"
- If foreign partitioned is not done properly, it can backfire on performance
- For example:
- queries do a filter by birth-date from a table that was partitioned by zip code or cities
- In this situation, all queries would need to be run on all foreign partitions (shards) to get full result!
- It only makes sense to shard:
- if the nature of the queries involve around partitioning key!
- OR if advantage gained out of it is far greater than any overhead
- Foreign data partitioning (sharding) should be considered in those situations where you can’t efficiently break down a big table through data normalization or use an alternative approach and maintaining it on a single server is too demanding
- Sharding is NOT share-all replication!