Comparing UUIDv4 and UUIDv7 Performance in PostgreSQL

May 23, 2025 4 answers
Asked by CoilSpring
Hey folks! I recently conducted a benchmark test in PostgreSQL comparing UUIDv4 and UUIDv7 by inserting 10 million rows of each type. I looked into various metrics like table and index disk usage, point lookup performance, and range scan performance. To my surprise, UUIDv7, being time-ordered, had a significantly better performanceโ€”up to 35% in some cases! I've detailed my findings, including the data and queries used, in an article linked in the first comment. If you'd like, I can also share a summary here!

Answers

~move to amend
Just to confirm, what specific metrics did you track during the benchmarking? Iโ€™d like to understand how you measured the performance effectively.
Reply to this answer
maybe.later.
Nice to see results on UUID performance! Is there a link to your full analysis with the queries and data used? I'd love to check it out!
Reply to this answer
!groutMix3
How did you set up the benchmark? Did you use a specific tool, or were you using a back-end framework? I want to learn how to run my own tests to optimize my database projects.
Reply to this answer
tile.6hex
It seems like a bit of an overkill to run such a massive benchmark just for UUID types, but I guess every performance gain counts! What was your main goal with this test?
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions