▲ | pilif a day ago | |||||||
One thing that’s not quite clear to me is how safe it is to generate v7 uuids on the client. 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 a day ago | parent | next [-] | |||||||
How many clients requests do you get in the same millisecond? 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. | ||||||||
| ||||||||
▲ | qeternity a day ago | parent | prev [-] | |||||||
If the client can generate a uuid4 they can also reuse a known uuid4 |