6 ms·
Or UUID...
by trendia 9y ago
Or UUID...
- derefr 9y agoI pick UUIDs because experience has taught me that even for the smallest workloads, I'll inevitably have to shard my DB (to partition a shared public cloud from N isolated "enterprise" deployments), and then will inevitably want to do statistical-analysis things that involve ingesting rows from the shards (or log entries referencing those rows), and deduplicating them by ID, without generating false-positive collisions in the process. The simplest way to do that is to just throw UUID at all problems from the start. (https://github.com/alizain/ulid https://github.com/alizain/ulid s are better, but there aren't libraries to generate them in literally every language + RDBMS.)
- eru 9y agoI don't agree with all their reasoning---but ulid still seems like a good idea. (Though the main difference you care about in programming is how they are generated---via timestamps plus randomness, not that they have a different serialization format.) For some applications you don't want to leak the time. Choose wisely.