The Problem With UUIDs

186,224
0
Published 2024-05-07
THANK YOU PLANETSCALE FOR SPONSORING THIS VIDEO

UUID's have a time and place, but I rarely see them used correctly. I've wanted to do this rant for awhile and I'm happy I did because CUID2 is NOT a good option either 🙃

SOURCE
planetscale.com/blog/the-problem-with-using-a-uuid…

Check out my Twitch, Twitter, Discord more at t3.gg/

S/O Ph4se0n3 for the awesome edit

All Comments (21)
  • @averageemogirl
    "hey guys! today i will be talking about something i clearly don't understand" is a great summary of this video
  • @einrealist
    UUID versions are NOT supposed to replace each other. They are just different implementations that address different problem domains. Once humans become a serious space-faring civilization, we probably need yet another UUID version for problems like time dillation. But such a UUID V99 is not supposed to replace V4, but to complement it. V4 can still be used within certain bounds.
  • It's amazing watching somebody talk shit about something he obviously doesn't understand beyond his sponsors blog post
  • @eamonburns9597
    17:58 Just so you know, "I'm not telling you the difference between them, that's your problem", takes a lot more time to say than "1 byte is 8 bits"
  • @cherubin7th
    I propose v9, it is the same as v4, but instead of a 4 it has a 9. This changes everything.
  • @xdaniels13
    Oh I am still waiting on the video about PlanetScale removing the free plan and the cheaper price twice as much as competitors...
  • @rikschaaf
    3:49 To my knowledge, not all versions in UUID should be seen as "the next version". Some are more like variants than versions. That's why both v1 and v4 are still used often. You could say that variant 5 is a new version of variant 3 though, because we now have better hashing algs that might have not been considered in v3. Variant 6 similarly is a new version of v1, where they reordered the date to be sortable (with v7 being a variant of that). You shouldn't think of every new -"version"- variant being better than the previous, but that they complement each other.
  • @chepossofare
    The proble with UUIDs is that you are not using PostgreSQL.
  • @workmad3
    Thinking about the different UUID variants as 'versions' that replace previous versions isn't quite right... the idea is that the different variants are used in different circumstances, so a deterministic variant is useful in some circumstances. Which is why there's a 'variant' number in it, so different variants can be checked differently.
  • @tarunpai2121
    Dude literally just read an article and nothing more. Offer some POV at least. - I don't understand if this is really an issue with mysql or with postgres too? - Is this even as big a problem? or is it just clickbait? - What's the actual performance impact? there's a lot of "perf issues" thrown around with no(?) benchmarks.
  • @ChrysusTV
    "I spent years researching this to make sure I got it right. Turns out, I don't need to. Here's what my sponsor has to say." Sheeesh, DarkViper's video accurately notes a lot of key issues, like this one. Something always felt off about this channel and getting a different perspective really made things clear for me. This channel really is just regurgitation with, as you admit yourself in the first few seconds, little research.
  • @dijikstra8
    Using a char(36) to store a uuid just seems like the worst idea every, does anyone actually do this? Postgres has a specific datatype for uuid, does MySQL still not have that?
  • @supersat
    V1 was a pretty good idea because collisions were basically guaranteed to never occur. But that was in a world where MAC addresses were guaranteed to be unique, and VMs basically killed that.
  • @danhorus
    This channel does read a lot of blog posts
  • @steveoc64
    Javascript programmer using MySQL gives us a tech talk about the importance of performance at scale lol
  • btw it is an RFC, not just a proposal anymore. But there were many wrong assumptions in this video.
  • @benmeehan1968
    Curious why there is no evidence regarding performance, only vague handwaving that storage space is a factor. What this does show is that MySQL has an incrementing index type and an indexing mechanism that is optimised for incrementing indexes. My (naive) understanding was that with a B-Tree, if the index values were random, the tree will likely tend towards being balanced (at least over time), and that B-Trees don't perform well with sequential index values, hence the need for an optimisation. Sequential values don't scale horizontally, hence the need for a larger 'namespace'. Sequential 32 bit values and random 128 bit values are apples and oranges, and meet different requirements. Choose your index keys appropriately, if horizontal scalability is a likely to be a factor (which is often a guess when we don't know just how large or distributed a storage system is going to be). Clearly a UUID can't compete with a 32bit sequential when you have a single key generator, but a 32bit sequential can't even function when there are multiple key generators (without segmenting the address space). Horses for courses.
  • @loganyt8818
    instead of PlanetScale sponsoring Theo, they should have used that money to keep reasonable free plan
  • @NicolasTroncoso
    I believe there is some confusion about sortability. All primary keys are sortable, regardless of the value. They will fit in the B+ Tree pages with different packing sizes, and with the balancing issues described in the video. What some people want is that records are sorted by creation time. Which is what the CUID post talks about. Don't worry about the record being naturally sorted by creation time. Use a random key to avoid hot spots, and use a createAt (or reverse CreatedAt) index if you need to scan the table the naturally created order.
  • @dragons_advocate
    "Planetscale is not very liked atm..." -- "Thank you planetscale for sponsoring this video"