Post #1252118
2025-10-10 10:21 UTC
#TIL about UUID7 (mainly because it's now supported in the new #python 3.14). Until today I thought, why bother, uuid4 is fine.
Turns out, UUID7 comes with a free timestamp and the generated ids sort by time.
Read about it here
https://uuid7.com/
And it's available as a library for older python versions, too. https://pypi.org/project/uuid7/
I have a few projects where I use UUID4 for temporary files - I'm going to move these over to UUID7
Replies (4)
-
@treyhunner@mastodon.social 2025-10-10 18:38
@mborus just don't mix UUID4 & UUID7 in the same data or you'll end up with old data randomly interleaved within new (nicely sorted) data. I have UUIDs on a Django app that I can't update and switching over now won't do me any good.
-
@hynek@mastodon.social 2025-10-11 09:44
@mborus that and Postgres 18 just added it too! (I’ve been an uuid7 enthusiast for a while so I’m very excited by this double-drop) https://www.postgresql.org/about/news/postgresql-18-released-3142/
-
@rmistaken@hachyderm.io 2025-10-11 10:19
@mborus fyi that uuid7 package is not compliant with latest spec and not a backport of the upstream implementation
-
@markwalker@fosstodon.org 2025-10-11 12:20
@mborus I've been using UUID4 for years. Now I need to see what I've been missing 👀