Version 7

(timestamp, random)

01960258-f7c7-79af-8142-63bb11e9bf6a

Generate next UUID
Explanation from Wikipedia

Version 7 UUIDs(UUIDv7) are designed for keys in high-load databases and distributed systems.

UUIDv7 begins with a 48 bit big-endian Unix Epoch timestamp with approximately millisecond granularity. The timestamp can be shifted by any time shift value. Directly after the timestamp follows the version nibble, that must have a value of 7. The variant bits have to be10x. Remaining 74 bits are random seeded counter(optional, at least 12 bits but no longer than 42 bits) and random.

Two counter rollover handling methods can be used together:

In DBMS UUIDv7 generator can be shared between threads(tied to a table or to a DBMS instance) or can be thread-local(with worse monotonicity, locality and performance).