UUID v7

Andrey Borodin <amborodin86@gmail.com>

From: Andrey Borodin <amborodin86@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: brad@peabody.io, wolakk@gmail.com, kydavis@cisco.com, Nikolay Samokhvalov <samokhvalov@gmail.com>
Date: 2023-02-10T23:57:50Z
Lists: pgsql-hackers

Attachments

Hello pgsql-hackers!

As you may know there's a new version of UUID being standardized [0].
These new algorithms of UUID generation are very promising for
database performance. It keeps data locality for time-ordered values.
>From my POV v7 is especially needed for users. Current standard status
is "draft". And I'm not sure it will be accepted before our feature
freeze for PG16. Maybe we could provide a draft implementation in 16
and adjust it to the accepted version if the standard is changed? PFA
patch with implementation.

What do you think?

cc Brad Peabody and Kyzer R. Davis, authors of the standard
cc Kirk Wolak and Nik Samokhvalov who requested the feature

Thanks!

Best regards, Andrey Borodin.

[0] https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04

Commits

  1. Fix timestamp overflow in UUIDv7 implementation.

  2. Add UUID version 7 generation function.

  3. Add some UUID support functions