UUIDs are 128-bit numbers used as unique identifiers across systems without requiring coordination. There are 8 versions, each generated differently: UUID4 (fully random) is the most widely used for database primary keys, temp files, and config profiles. Its main drawback for DB use is poor index locality due to randomness. UUID7, now being added to Python 3.14 and Postgres, addresses this by embedding a Unix timestamp for chronological sorting, making it a drop-in replacement for UUID4. The tradeoff is that UUID7 leaks creation timestamps, which may be a privacy concern in some applications. The post covers all versions, generation examples in Python/Bash/PowerShell, and practical guidance on when to use each.
Table of contents
SummaryApparently, it's importantThe need for uniquenessAn interesting ideaWhich one should I use, and for what?Sort: