educative.io

Partitioning based on ShowID

Database partitioning: If we partition by ‘MovieID’, then all the Shows of a movie will be on a single server. For a very hot movie, this could cause a lot of load on that server. A better approach would be to partition based on ShowID; this way, the load gets distributed among different servers.

if we shard by showid, does that mean we need to call all the database partitions to get every show that a user has booked?

Yes. If we shard by ShowID, data gets distributed and let’s suppose instead of a single sever, now it is distributed into 3 servers. Then it will not cause a huge load on a single server and will use these 3 servers for any query or access of any data.