Remix.run Logo
▲ nitwit005 6 hours ago

The Python version simply forces the timestamp forward if needed to preserve ordering:

  if timestamp_ms < _last_timestamp_v7:
    timestamp_ms = _last_timestamp_v7 + 1
https://github.com/python/cpython/blob/8d119208074fef0f652f1...

But if you did want "monotonically increasing IDs", as the article suggests, that is what you want.

▲vbezhenar an hour ago | parent | next [-]

So you can't generate more than 1000 UUIDs per second without skewing timestamp portion? That's not a lot. Bulk imports often require a lot more inserts.

▲dpark 5 hours ago | parent | prev [-]

This is perfect if you only have one machine and the process never restarts. But then if you only have one machine you don’t realistically need uuid identifiers.

▲Lammy 4 hours ago | parent [-]

This is why the oldschool UUIDv1 spec specifies initializing the sequence value at a random number:

“12.4.4 — The Clock Sequence shall be originally (that is, once in the lifetime of a system producing UUIDs) initialized to a random number that is not derived from the Node value. NOTE – This is in order to minimize the correlation across systems, providing maximum protection”