3 ms·
Why not just use the UUID as the ID?
by fastball 8y ago
Why not just use the UUID as the ID?
- jon-wood 8y agoUsing a UUID as your primary key can make certain optimisations much harder down the road, most notably sharding which tends to balance really nicely if you do it on an auto-incrementing numeric ID, and less so if you're using random strings because you'll end up with with some of them clustering. They're also much harder to pass around in cases where you need to refer to a specific record, for example if you've got someone in tech support who needs help with a particular object its much easier to say "its record 18434" than it is to try and read out a UUID over the phone.
- dexterdog 8y agoAnd it's much easier for that person to mishear/miskey that ID and work on the wrong record. With a random UUID you will not have that mistake unless you have some seriously huge data. Base64 encode it everywhere and it's 22 characters.
- fastball 8y agoEven with the world's largest dataset, I don't think you will experience an "off-by-one" error with the UUID4 standard.