4 ms·
How does one generate ordered UUIDs right on the PostgreSQL server?
by httgp 6y ago
How does one generate ordered UUIDs right on the PostgreSQL server?
- solicode 6y agoThere's probably a nicer way (or more performant at least), but I created a function that uses the built-in `uuid_generate_v1mc` and then reverse the order of the time component so that high values come first.
- Tostino 6y agoUse this: https://github.com/tvondra/sequential-uuids https://github.com/tvondra/sequential-uuids If you cannot install extensions, I just wrote a PL/PGSQL implementation for the time-based generator I could share.