UUIDv7 Outperforms UUIDv4 in PostgreSQL Insert Speed and Index Size

PostgreSQL 18 introduced native support for UUIDv7, and a benchmark compares it against UUIDv4 for primary key insertion. The tests measured insertion time and on-disk index size across datasets of 1, 10, and 100 million rows. On small datasets the insert times were nearly identical, but at larger scales UUIDv7 was reported to be close to ten times faster. The UUIDv7 index was also consistently about a quarter smaller than the UUIDv4 index. The gap is attributed to how B-tree indexes handle the time-ordered UUIDv7 values compared with random UUIDv4 values.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in