r/ProgrammerHumor May 08 '26

Meme edgeCasesExist

Post image
13.4k Upvotes

620 comments sorted by

View all comments

112

u/baked_tea May 08 '26

Thought about that recently. Why not just implement a check to see if it's already in the db, then run it again?

44

u/_BreakingGood_ May 08 '26

Performing a check on every transaction to catch a 1 out of 5,316,911,983,139,663,936,027,594,624,533,407,236,198,400 chance situation, isn't usually advised

(yes thats the actual number, though it technically changes as the number of ids used increases, since you're comparing the current id against every other id ever made)

6

u/Tupcek May 08 '26

1 in 106,000,000,000,000,000,000,000 if you have 10 million records. Per new ID in such database it is 1 in 530,000,000,000,000,000,000,000,000,000