Live data from Hacker News

UUIDs are popular, but bad for performance (2019)

percona.com

131–140 of 246 posts

Re: UUIDs are popular, but bad for performance (2019)

#131

Isn't this easily solved by supporting 128 bit keys and using UUIDs as intended, i.e. as integers and not in their string serialization? This is as nonsensical as storing IPv4 as strings instead of 32 bit integers.

That's only part of it, the major problem with classic UUIDs are that writes occur randomly across the entire keyspace. Whether it's represented as a string or in binary, ordering does not change, and so the underlying indexing method must cope with these random orderings at insertion time. At least btrees perform much worse with random insertions. I don't know how much impact it has on LSM

LSMs and fractal trees handle random inserts much better. But you still lose locality of lookups: items generated near each other time-wise are not correlated on disk.

Re: UUIDs are popular, but bad for performance (2019)

#132
I'm sure I take bigger penalty hits for less, sorry but UUID's "click" in my head and they prevent a whole slew of foot-guns. It would be one thing if auto-inc was the same as UUID but there are really annoying things with auto-inc (not knowing the id until after insert being top of mind) and also you can generate UUID's client-side/offline if needed. Yes, I know some people argue for auto-inc as primary and still use UUID for client-facing but I don't understand what that really gets you and it seems way more complicated.

Re: UUIDs are popular, but bad for performance (2019)

#133
I recently read a book by Google’s head guy on API design that was specifically about designing APIs and it had a big section on what makes a good identifier and why people reach for UUIDs and why specifically it is a problem on multiple levels.

The thing that he ended up recommending however was super interesting in that I had never seen it mentioned before but it was basically to use this instead http://www.crockford.com/base32.html

Re: UUIDs are popular, but bad for performance (2019)

#134
post #118

Isn't this easily solved by supporting 128 bit keys and using UUIDs as intended, i.e. as integers and not in their string serialization? This is as nonsensical as storing IPv4 as strings instead of 32 bit integers.

They do test a binary(16) field which is basically what you're talking about (and you could use a binary(32) for a 128-bit UUID).

16 bytes is 128 bits. Why would you use 32?

Re: UUIDs are popular, but bad for performance (2019)

#135
post #133

I recently read a book by Google’s head guy on API design that was specifically about designing APIs and it had a big section on what makes a good identifier and why people reach for UUIDs and why specifically it is a problem on multiple levels. The thing that he ended up recommending however was super interesting in that I had never seen it mentioned before but it was basically to use this instead http://www.crockfo…

What was the book?

Re: UUIDs are popular, but bad for performance (2019)

#136
post #127

Earlier quoted context omitted.

The point is, a uuid contains 128 bits of data, so a varchar(32) is still somewhat excessive

Why varchar over char? The length is always the same.

Yeah, true. My bad. I'm used to calling everything TEXT.

Re: UUIDs are popular, but bad for performance (2019)

#137
post #133

I recently read a book by Google’s head guy on API design that was specifically about designing APIs and it had a big section on what makes a good identifier and why people reach for UUIDs and why specifically it is a problem on multiple levels. The thing that he ended up recommending however was super interesting in that I had never seen it mentioned before but it was basically to use this instead http://www.crockfo…

I see this around the crypto world a lot lately (notably for Substrate/Polkadot addresses): base58 https://tools.ietf.org/id/draft-msporny-base58-01.html

Seems to have the same idea of "human-read-write without visually identical characters" but with an expanded set for shorter string length.

Re: UUIDs are popular, but bad for performance (2019)

#138
post #133

I recently read a book by Google’s head guy on API design that was specifically about designing APIs and it had a big section on what makes a good identifier and why people reach for UUIDs and why specifically it is a problem on multiple levels. The thing that he ended up recommending however was super interesting in that I had never seen it mentioned before but it was basically to use this instead http://www.crockfo…

[deleted]

Re: UUIDs are popular, but bad for performance (2019)

#139
post #133

I recently read a book by Google’s head guy on API design that was specifically about designing APIs and it had a big section on what makes a good identifier and why people reach for UUIDs and why specifically it is a problem on multiple levels. The thing that he ended up recommending however was super interesting in that I had never seen it mentioned before but it was basically to use this instead http://www.crockfo…

This format was discussed in a HN first page post just this week:

> This alphabet, 0123456789ABCDEFGHJKMNPQRSTVWXYZ, is Douglas Crockford's Base32, chosen for human readability and being able to call it out over a phone if required.

https://news.ycombinator.com/item?id=29794186

Re: UUIDs are popular, but bad for performance (2019)

#140
post #133

I recently read a book by Google’s head guy on API design that was specifically about designing APIs and it had a big section on what makes a good identifier and why people reach for UUIDs and why specifically it is a problem on multiple levels. The thing that he ended up recommending however was super interesting in that I had never seen it mentioned before but it was basically to use this instead http://www.crockfo…

What was the book?

https://www.bookdepository.com/API-Design-Patterns-JJ-Geewax...

I loved it, think it all made a ton of sense. Lots of code samples, no weird technology choices (normally they would do it all via protobufs and gRPC but they keep the same principles and just use HTTP instead and Typescript for code samples)

Post reply on HN