(no title)
pilif | 4 months ago
That’s one of the nice properties of v4 uuids: you can make up a primary key of a new entity directly on the client and the database can use it directly. Sure: there is tiny collision risk, but it’s so small, you can get away with mostly ignoring it
With v7 however, such a large chunk of the uuid is based on the time, so I’m not sure whether it’s still safe to ignore collisions in any application, especially when you consider client’s clocks to probably be very inaccurate.
Am I overthinking things here?
PhilippGille|4 months ago
With UUIDv7 it's split into:
- 48 bits: Unix timestamp in milliseconds
- 12 bis: Sub-millisecond timestamp fraction for additional ordering
- 62 bits: Random data for uniqueness
- 6 bits: Version and variant identifiers
So >4,600,000,000,000,000,000 IDs per fraction of a millisecond.
And unprecise time on the client doesn't matter, because some are ahead and some behind, vut that doesn't make them more likely to clash.
cenamus|4 months ago
qeternity|4 months ago