3 ms·
I've always disagreed with that post, and I've seen others with the same thoughts when this was mentioned on HN before. Specifically: "Don’t be naive": that's
by lights0123 6y ago
I've always disagreed with that post, and I've seen others with the same thoughts when this was mentioned on HN before. Specifically:
"Don’t be naive": that's just talking about storing the UUID wrong. You could design your schema badly and store your integer primary key as a string type too, but the post doesn't mention that.
"UUIDs are a pain": so just don't memorize primary keys?
"Planning for real scaling": ok, each record uses 16 bytes instead of 8. But their proposed solution, "Best of Both", uses both 8 and 16 byte records.
"Primary keys get around in normalized databases": finally a real problem.
"It’s really hard to sort random numbers": also potentially a problem—I'm not familiar enough with clustering so I can't offer any thoughts.
"My keys will never change (until they do)": they never explain why they needed to change PKs when migrating DBs
- mikepurvis 6y ago> they never explain why they needed to change PKs when migrating DBs Not a migration scenario, but thinking of other kinds of consolidations, like folding together separate Employee tables after a company merger.
- ldng 6y agoWouldn't you have a lot more issues than just ids ? It very improbable that folding 1:1 would be even possible. You'll much more likely have to do a migration merging relevant information into a new table. So the question holds, when do you change a PK ?
- oxfordmale 6y agoDatabase migrations