Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How does one generate ordered UUIDs right on the PostgreSQL server?


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: