Hacker News new | ask | show | jobs
by globular-toast 1629 days ago
Yeah. The main problem is people using them as primary keys in naïve systems like relational databases. You can't just expect a relational database to magically become a distributed system just by using UUIDs. There is a bit more work to do than that.
3 comments

People use UUIDs for more reasons than just making things distributed. You can generate them client side if that's advantageous, you prevent leaking information about how many records there are in the system and prevent guessing of other potential PKs and potential unauthorized access, and there's some optimization strategies that benefit from not relying on a serial PK.
If you're obfuscating, then you should be using a DHT to map surrogate keys to internal keys that are more convenient for use in a MySQL index... or just stop using MySQL.
Well they shouldn't. UUIDs are for distributed systems. Generating keys client side? That's a distributed system.
I've had occasional uses for it in systems that aren't distributed at all. It's a handy property of UUIDs, if UUIDs are useful for a particular use case, I'm going to use them, what they're 'supposed' to be for is irrelevant.
> You can't just expect a relational database to magically become a distributed system just by using UUIDs.

Nobody thinks this, do they?

You’d be surprised. Unpleasantly, unfortunately.

Not sure if the term gets used much now a days, but ‘cargo cult’ programming is definitely a thing still. Never stopped.

Somebody thought RabbitMQ did load balancing because it had three redundant nodes. Pretty much ruined the company. Definitely caused all of us to lose our equity.
I’d love to hear that story.
Is it too much to ask people to explain what's wrong with this well-written and on-topic comment instead of downvoting it?
Calling relational databases (HN’s preferred storage system) naive probably sounds like trolling to most people. There are also plenty of distributed relational databases. People downvote comments that sounds like trolling or flamebait.

I use UUIDs but I don’t know why they would magically make my Postgres a distributed system. I like them because the client can generate them offline.

What? Really? Naïve in this context means a general purpose solution that doesn't "know" about your use case. Have people never heard of a naïve algorithm or solution?

Distributed relational databases aren't naïve in this context. MySQL is.

> Have people never heard of a naïve algorithm or solution?

I have a fairly recent PhD in algorithms and I haven't heard naïve used this way. When I hear naïve, it usually just means "does the immediately obvious thing".

For what you're trying to say, the term I'm familiar with is "oblivious", e.g. "oblivious routing" or "oblivious local search", occasionally with modifiers such as "cache-oblivious".

I've never heard use of the word "oblivious", but my education is 15 years old at this point.
Naive is an emotionally loaded word outside of academic communities.
"naïve systems" doesn't make sense.

Nobody is assuming simply adding a UUID transforms a system into a distributed one.

The parent comment is about exposing UUIDs probably in order to not expose the sort order of the database.