DEV Community

Jonathan Hall
Jonathan Hall

Posted on • Originally published at jhall.io on

1

What are the odds?

Not long ago I had a conversation about random UUIDs with a client I was working. This person expressed concern that the version 4 UUIDs we were using might suffer a collision. They are not alone in this concern.

So what are the odds of a collision?

Speaking of v4 UUIDs, which contain 122 bits of randomness, the odds of collision between any two is 1 in 2.71 x 1018 Put another way, one would need to generate 1 billion v4 UUIDs per second for 85 years to have a 50% chance of a single collision.

Worrying about this is an example of the Law of triviality at play, roughly stated “people commonly give disproportionate weight to trivial issues.” This is where the popular aphorism about bike-shedding originates.

There are always MUCH bigger business problems to spend time on.

To demonstrate how trivial the issue of UUID collision is, let’s consider some other things that are more likely to occur which may impact your team, but which also often get less attention:

  • 1 in 2.71 x 1018 : Two random v4 UUIDs collide
  • 1 in 7.87 x 109 : Melinda French Gates divorces you and takes a portion of your business assets
  • 1 in 1.10 x 107 : Your most senior colleague dies an airplane accident in the next 12 months, before documenting their work
  • 1 in 2.02 x 105 : Your data center is destroyed by a nuclear strike
  • 1 in 2.6 x 103 : Your boss resigns tomorrow
  • 1 in 1 x 102 : You suffer data loss due to disk or SSD failure
  • 1 in 1 x 101 : Your laptop and its data are stolen

Technically speaking, UUID collision can happen. But even for critical applications, the odds are so low as to be dwarfed by the odds of truly catastrophic events, like nuclear war. This means most of us will get a much better ROI on our thinking time by focusing on problems that actually affect our businesses.


If you enjoyed this message, subscribe to The Daily Commit to get future messages to your inbox.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs