Test: Python's UUIDv7 is monotonic only within a single process
A DEV Community analysis of uuid.uuid7() in CPython 3.15.1 found zero inversions across 1 million IDs in one process, but 46.6% of causally ordered cross-process pairs sorted backwards. After a one-hour clock rollback, the embedded timestamp advances 1 ms per generated ID.
- 1M UUIDv7 in one process: 0 inversions at 384,288 IDs/s
- Across processes, 46.6% of causally ordered pairs inverted
- Naive counter-free layout gives 49.9% same-millisecond inversions
- One-hour clock rollback: timestamp runs ~100 s ahead per 100k IDs
Read next
Policy