UUID Generator

PostgresGUIPostgresGUI

Click to copy

UUIDv4 or UUIDv7 for PostgreSQL?

UUIDv4 is random. UUIDv7 begins with time information, so newly generated values are roughly ordered and friendlier to a growing B-tree primary-key index. PostgreSQL 18 can generate both with uuidv4() and uuidv7().

Older PostgreSQL releases can store either version in a uuid column, but UUIDv7 generation must come from your application or an extension. Existing UUIDv4 keys do not need to be rewritten.

Read the PostgreSQL UUIDv4 vs UUIDv7 guide