logoalt Hacker News

bddickenyesterday at 9:53 PM2 repliesview on HN

Simple sequential IDs are great. If you want UUID, v7 is the way to go since it maintains sequential ordering.


Replies

omcnoetoday at 1:18 AM

There are subtle gotchas around sequential UUID compared to serial depending on where you generate the UUIDs. You can kinda only get hard sequential guarantee if you are generating them at write time on DB host itself.

But, for both Serial & db-gen’d sequential UUID you can still encounter transaction commit order surprises. I think software relying on sequential records should use some mechanism other than Id/PK to determine it. I’ve personally encountered extremely subtle bugs related to transaction commit order and sequential Id assumptions multiple times.

jwpapiyesterday at 11:28 PM

Does all of that apply to Postgresql as well or only Mysql?

show 1 reply