logoalt Hacker News

tmountainyesterday at 11:34 AM4 repliesview on HN

Sticking with sequences and other integer types will cause problems if you need to shard later.


Replies

sgarlandyesterday at 2:18 PM

There are plenty of ways to deal with that. You can shard by some other identifier (though I then question your table design), you can assign ranges to each shard, etc.

bigmadshoeyesterday at 5:31 PM

I’m really no expert on sharding but if you’re using increasing ints why can’t you just shard on (id % n) or something?

show 1 reply
SoftTalkeryesterday at 5:43 PM

This is mentioned, and in many applications you can safely say you will never need to shard.

show 1 reply
zwnowyesterday at 11:43 AM

Especially in larger systems, how does one solve the issue of reaching the max value of an integer in their database? Sure for unsigned bigint thats hard to achieve but regular ints? Apps quickly outgrow that.

show 1 reply