DEV Community

Cover image for Shrink UUIDs with PostgreSQL or Ruby

Shrink UUIDs with PostgreSQL or Ruby

Sven Schwyn on February 23, 2024

For a pet project of mine, I'm experimenting with alternatives to the classic SERIAL primary keys which are simple, local and performant. However, ...
Collapse
 
svoop profile image
Sven Schwyn • Edited

There's a discussion going on to make UUIDv7 (or similar) part of the PostgreSQL core itself. Depending on when the formal standard is finalized, this feature might even make it to PostgreSQL 17 later this year. 🎉

Collapse
 
svoop profile image
Sven Schwyn

Just added an update to mention that UUIDv7 didn't make it in time for PostgreSQL 17 but are en route for version 18 in fall 2025. See the update note in my original text for easy workarounds on Homebrew and Gentoo Linux.

Collapse
 
svoop profile image
Sven Schwyn

Here's a little followup: In case you're on Mac or Linux and would like to experiment with UUIDv7 locally, you can use my Homebrew formula to install the pg_uuidv7 extension it on your machine.