Re:ULIDs and Primary Keys
by crazygringo on Thursday December 29, 2022 @07:04PM
(#34179851)
In my experience sharing is generally done on a "technical" key because it's easy to arbitrarily partition into any desired number of shards.
Something like per-year could result in different years having vastly different disk usage requirements, which would be a headache.
While per-region or per-customer isn't really sharding at all in my understanding. It's just giving each customer (or region) their own dedicated/private database.
Sharding is generally about dividing a single table (for business logic purposes) among (usually) equally-sized servers for performance/capacity reasons, according to some function of the primary key (modulus, hash, etc.).
Something like per-year could result in different years having vastly different disk usage requirements, which would be a headache.
While per-region or per-customer isn't really sharding at all in my understanding. It's just giving each customer (or region) their own dedicated/private database.
Sharding is generally about dividing a single table (for business logic purposes) among (usually) equally-sized servers for performance/capacity reasons, according to some function of the primary key (modulus, hash, etc.).