fboulnois / pg_uuidv7

A tiny Postgres extension to create version 7 UUIDs
Mozilla Public License 2.0
270 stars 23 forks source link

Generated values not always monotonic #10

Closed gusbzs closed 10 months ago

gusbzs commented 10 months ago

Hi, thanks for creating this extension!

When I generate multiple UUIDv7 values with the same timestamp component, the resulting values are not always monotonic: image

If I sort the generated values, they end up in a different order:

Could you please confirm if this is the expected behavior?

Thanks in advance!

fboulnois commented 10 months ago

Yes, this is the expected behavior. The final 74 bits after the timestamp are random.

gusbzs commented 10 months ago

OK, that's good to know, thank you!