Live data from Hacker News

Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

github.com

41–50 of 236 posts

Re: Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

#41
post #38

Earlier quoted context omitted.

No identifier can guarantee that. We just get close enough to be acceptable. Per Wikipedia, the probability to find a duplicate within 103 trillion version-4 UUIDs is one in a billion. so-youre-saying-theres-a-chance.gif

A billion is not that big of a number for UUIDs

Re-read. You'd have to generate 103 trillion to have a one billionth chance of a collision.

A billion isn't that big a number, but 103 trillion is.

Re: Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

#42
post #22

Earlier quoted context omitted.

You can prevent any obscenity, O and 0 confusion, and I and L confusion, just by excluding vowels. If someone interprets "f4g" in an offensive way, then they have bigger issues than can be dealt with in software.

Why we care about obscenity in pseudo-random ids and url?

anglo morals

Re: Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

#44

UUIDv7 has been taking HN by storm for years now! When is it going to become a proper standard, and when are libraries and databases and all the rest going to natively support it?

What kind of support do you expect? I'm pretty sure that absolute majority of software does not care about any particular bits in UUID, so you can use it today. If some software cared about any particular bits, just imitate UUIDv4, I mean those bits could be randomly generated as well. If you need generation procedure, write it yourself, it's easy.

Re: Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

#45

Earlier quoted context omitted.

> combining time + random number You can't guarantee that this will be globally unique.

No identifier can guarantee that. We just get close enough to be acceptable. Per Wikipedia, the probability to find a duplicate within 103 trillion version-4 UUIDs is one in a billion. so-youre-saying-theres-a-chance.gif

I have single datasets with trillions of UUID. Collision probability becomes a thing.

That aside, UUIDv4 is banned in many orgs because there have been several instances in the wild where the “random” number wasn’t nearly as random as advertised from some sources for a variety of reasons, leading to collisions. It is relatively easy to screw this up so many orgs don’t risk it.

Re: Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

#46
Neat! Love the "type-safe" prefix; we'd called them "tagged ids" in our ORM that auto-prefixes the otherwise-ints-in-the-db with similar per-entity tags:

https://joist-orm.io/docs/advanced/tagged-ids

We'd used `:` as our delimiter, but kinda regretting not using `_` because of the "double-click to copy/paste" aspect...

In theory it'd be really easy to get Joist to take "uuid columns in the db" and turn them into "typeids in the domain model", but probably not something that could be configured/done via userland atm...that'd be a good idea though.

Re: Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

#47
post #38

Earlier quoted context omitted.

A billion is not that big of a number for UUIDs

Re-read. You'd have to generate 103 trillion to have a one billion th chance of a collision. A billion isn't that big a number, but 103 trillion is.

I think you made a mistake in your math. The Birthday Collision probability of just a trillion random UUID is much higher than that.

Re: Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

#48
post #4

Unrelated, but this links to "Crockford's alphabet", https://www.crockford.com/base32.html , which is a base-32 system that includes all alphanumeric characters except I and L (which are confusable with 1), O (which is confusable with 0), and U (????). The page says the reason for excluding U is "accidental obscenity'. What the heck is it talking about?

If I and O are already excluded and you also exclude U that removes a lot of potential rude looking three letter combinations like *** and *** and *** and also the four letter ones like **** and **** and the dreaded ****. Of course because you have A then **** is still a possibility but very very unlikely

Re: Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

#50

Earlier quoted context omitted.

Re-read. You'd have to generate 103 trillion to have a one billion th chance of a collision. A billion isn't that big a number, but 103 trillion is.

I think you made a mistake in your math. The Birthday Collision probability of just a trillion random UUID is much higher than that.

Feel free to update https://en.wikipedia.org/wiki/Universally_unique_identifier#..., but it does note "This probability can be computed precisely based on analysis of the birthday problem". It does show the formula used.
Post reply on HN