Menu
Back to Discussions

Database sharding strategies: hash-based vs range-based in practice

Julia Patel
Julia Patel
·1028 views
we've been running into some scaling limits with postgres lately, hitting around 50k writes/sec on our main tenant database which is getting a bit too close for comfort. we're a b2b saas, so we have a highly skewed tenant distribution some tenants are tiny, some are massive. sharding feels like the next logical step but deciding between hash-based and range-based is tricky. hash-based seems simpler to implement for distribution, but it makes it harder to deal with our 'whale' tenants, where a single large customer could still create a hot shard. range-based would let us dedicate shards to these big tenants, but then shard splitting or rebalancing is a much bigger headache as our tenant base grows. we're also considering a hybrid where we use range for some segments and hash for others. how have others tackled this, especially with skewed data sets? what were the practical trade-offs you ran into when picking one over the other?
0 comments

Comments

Sign in to join the conversation.

Loading comments...