News for hackers. Stuff that matters.
Re:Showdown: MySQL 8 vs. PostgreSQL 10 by jerrysievert on Wednesday May 23, 2018 @01:00PM (#17135759)
> It's pretty unlikely to get a collision

unlikely is not zero, which was why I commented. I'd hate to rely on uniqueness of something that has a chance of not being unique.

Re:Showdown: MySQL 8 vs. PostgreSQL 10 by openasocket on Wednesday May 23, 2018 @01:31PM (#17136087)
If you generate 1 billion UUIDv4s a second, it would take, on average, 85 years for you to produce a duplicate, and the resulting list of UUIDs would take up ~45 exabytes. And keep in mind that even if inserting a row fails because you've somehow managed to generate a duplicate UUID, it is trivial to make a new UUID and retry. Since the database enforces the uniqueness constraints of primary keys, I'm hard pressed to come up with a scenario in which generating a duplicate UUID would actually do anything serious.
Re:Showdown: MySQL 8 vs. PostgreSQL 10 by firebacon on Wednesday May 23, 2018 @02:01PM (#17136415)
GP pointed out the special version of the algorithm that handles collisions gracefully. Note that this algorithm ("open addressing") is so frequently used that you will probably find a variation of it in pretty much any piece of software you have ever used. It's a well-understood method, not only from a practical perspective but also in terms of theory; check out e.g.: https://en.wikipedia.org/wiki/Linear_probing