• Sources: primary
  • Summary: Nikolay Samokhvalov compared UUIDv4, UUIDv7 and int8 primary keys on Postgres 18.6 with 16 pgbench clients under memory caps. Past memory at 100M rows, UUIDv4 inserted at 0.62 to 0.69 of an ordered key on the same server, wrote 1.5 to 1.9 times the WAL per row from full-page images, and had a 33 percent larger index, while UUIDv7 kept pace with int8. The post advises generating uuidv7() on the server because client clock skew of plus or minus 60 seconds left 45 percent of leaves out of order.
  • Why it matters: Tables using gen_random_uuid() keys can switch new rows to uuidv7() with one ALTER COLUMN SET DEFAULT and cut index churn, WAL volume and standby replay cost.