UUID Primary Keys Debate

Comments debate the use of UUID variants (v4, v7, ULID) versus sequential auto-increment IDs or bigints as database primary keys, focusing on advantages like uniqueness and sortability against drawbacks in indexing, storage, and performance.

➡️ Stable 0.5x Databases
4,328
Comments
19
Years Active
5
Top Authors
#218
Topic ID

Activity Over Time

2008
2
2009
12
2010
21
2011
41
2012
45
2013
71
2014
103
2015
119
2016
174
2017
239
2018
164
2019
164
2020
213
2021
448
2022
509
2023
652
2024
749
2025
595
2026
7

Keywords

WordPress ULID HWRNG GP IME example.com PK mongodb.org RFC www.ietf uuid bits random entropy generate bob database library index string

Sample Comments

LaundroMat Dec 31, 2020 View on HN

Why did you not want to use UUID's?

NuSkooler Feb 24, 2016 View on HN

What's the use case here over a UUID?

wilg Aug 7, 2021 View on HN

If you don't think that's a concern then UUID8 is for you!

roscas Jun 28, 2025 View on HN

Care to example some usage cases? And why uuid over auto-increment sequenced number?

maxloh Feb 5, 2024 View on HN

What is the use case for UUIDv4/v7 when bigint is faster and uses less storage space?

tonyhart7 Oct 18, 2025 View on HN

Yeah, just use uuidv4 and another "ULID" if thats the casewhich is pointless

jozvolskyef Aug 6, 2021 View on HN

What are the advantages of sortable UUIDs with embedded timestamps over random 128 bits and a created_at column?

paulddraper Aug 6, 2021 View on HN

tl;drUse UUIDv4 and get on with your day.

Isn't this the reason UUIDs were invented?

derefr May 21, 2018 View on HN

Could you switch from UUIDv4s (what I assume you mean by “pure UUIDs”) to UUIDv1s?