Andrew Atkinson: PostgreSQL 18: 23x Faster Inserts With UUID V7
Software Engineer, Author, High Performance PostgreSQL for Rails
Andrew Atkinson: PostgreSQL 18: 23x Faster Inserts With UUID V7
📌 Overview We recently switched to version 7 (v7) uuid primary keys and saw significantly faster inserts for some tables. The databases were running Postgres 18.4 and mostly used v1 with some v4 uuid values for primary keys. Changing the column default involved running a single alter table command, but did require an exclusive lock on the table, blocking everything including selects. To solve that, we used a short lock timeout and lots of retries. The biggest speedup was 23x faster average execution time for a multi-row insert query called 12000 times per minute on a table with billions of rows.
0 comments
No comments yet.