r/DatabaseHelp • u/ratsock • May 22 '22
Some basic sharding questions
I'm trying to understand database sharding. My understanding is that you basically just have a bunch of database instances running with parts of your data on each, and you essentially put some logic on the application side that tells it which database instances to use for what. The database schemas then stay basically the same. In this case, sharding is more a logical construct we've added ourselves, rather than something inherent within the database itself?
Is this accurate, or is there some feature at the database level itself that supports sharding? How do you handle schema change propagation across these shards?
View all comments
Show parent comment
2
u/ratsock May 22 '22
ok I see. If it's configured in the DB engine, that means for example, there's a way to define the sharding rules in my postgres (or whatever) server itself and I wouldn't need to make any updates to the application itself (unless the application included any queries in it the would be inefficient to run in a sharded environment)? Adding sharding is more or less invisible to the application team, and the database team should be able to handle it largely in the background.
I assume this also gets complicated of I want to have multi region/zone failover, so would need to also make sure each individual shard is replicated and had individual load balances