3 ms·
> One advantage of using an incrementing integer is that rows will be ordered on disk based on when they were created If each identifier starts with a logical
by zzzcpan 8y ago
> One advantage of using an incrementing integer is that rows will be ordered on disk based on when they were created
If each identifier starts with a logical time, say lamport timestamp, you can still get the same ordering effect without incrementing integers in a centralized place somewhere.
- DrJosiah 8y agoHave used this to great results in postgres, mysql, redis, etc.
- skrause 8y agoI've written my own UUID generation function which uses the current timestamp with microsecond precision for the first 64 bits and a random value for the last 64 bits. So far it's been a great success. Collisions are extremely unlikely unless you have Google scale and generated UUIDs are mostly ordered.
- dvlsg 8y agoI've also done this at a medium ish scale. We had to be careful with how the uuids were generated, though. Specifically which portion of the bytes contained the timestamp (and in what order) since different databases store uuids differently.