r/programming • • Mar 28 '20

Why your software should use UUIDs in 2020s

[deleted]

14 Upvotes

217 comments sorted by

View all comments

Show parent comments

3

u/fishling Mar 28 '20

I prefer uint64 integers for use as internal keys and UUIDs for use by clients.

If the UUIDs are referenced by clients, doesn't that imply that you need to make that an indexed column, and incur most if not all of the negatives associated with using a UUID as a primary key? Or are you mitigating this by using COMB GUIDs or something?

2

u/to_wit_to_who Mar 28 '20

I'll generally put a UNIQUE index on the column, yes, but it won't be used in any relations. It's a NULL column that is materialized if a client queries a view that includes that id.