News for hackers. Stuff that matters.
Re:We Chose NanoIDs for PlanetScale's API by HippoBaro on Wednesday March 30, 2022 @12:48PM (#30857710)
So UUIDs were the perfect solution except that, if a user double-click a url with a UUID in it, it won’t select all of it.

Can’t you just… remove the hyphens? UUIDs are just arrays of bytes, the hyphens are not part of the data.

Instead, they use a less popular, less supported, more collision-prone ID format.

Re:We Chose NanoIDs for PlanetScale's API by jamesboehmer on Wednesday March 30, 2022 @12:59PM (#30857845)
You can also base62-encode the UUID's underlying integer and you get a short, URL-friendly identifier, while maintaining the power and uniformity of UUID. The claim with nanoID is that it's twice as fast as UUID, but I'm not sure how impactful that is given my services all spent orders of magnitude more time in I/O wait for a database after any UUID functionality.
Re:We Chose NanoIDs for PlanetScale's API by greatgib on Wednesday March 30, 2022 @07:25PM (#30862100)
Nanoid are really great. It is a smarter uuid4 with variable size and alphabet. It is also a lot faster to generate.

See that: https://blog.bitsrc.io/why-is-nanoid-replacing-uuid-1b5100e6...

By definition, if you base62 or base64 your uuid4 it will be longer (30%?).

This generate directly in the final encoding so it is a lot shorter. Based on the simulator calculation, you just need 24 chars to be equivalent to an uuid4 that is 35 chars.

But being able to determine the length of the resulting id is one of the greatest feature. Did it never happened to you the case that you would like a shorter uuid4 and think that you can just truncate it? Not realizing that some parts of the uuid have a special meaning and are not random...

Re:We Chose NanoIDs for PlanetScale's API by maxekman on Wednesday March 30, 2022 @01:58PM (#30858602)
Exactly, I’m surprised this would gain traction. UUIDs are much smaller when packed into bytes.

Notion seems to use UUIDs without hyphens in their links, and it works just fine.