New tables get uuidv7() as the default
Postgres 18 ships uuidv7() in core. It is a UUID with a timestamp prefix, so inserts land at the right edge of the index like an integer would, and you keep the part of UUIDs that mattered: generating keys anywhere, no collisions on merge.
id uuid PRIMARY KEY DEFAULT uuidv7()For an existing v4 table, swapping the default is enough. New pages pack tightly from then on, and a REINDEX CONCURRENTLY later tidies the rest.
postgresqlschema-design
Longer version: the post this came from.