Hacker News new | ask | show | jobs
by httgp 1977 days ago
How does one generate ordered UUIDs right on the PostgreSQL server?
2 comments

Use this: 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.

Please do I have been looking for that. Posting it in the repo would help a few people k am guessing.
There'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.