Well, UUID stands for something UNIQUE. How that happend that it simply doesn’t work?
I had to use a program that generates some random data in the database. The primary key is UUID, so the program generates a lot of UUIDs. It uses standard Java’s way of generating UUIDs, the function: UUID.randomUUID().
That program failed twice, it was a database error, that the UUID exists in the database. I’ve created only a litttle bit over 50k of database rows. There were two collisions. What a crap.
I told that the author of the software, he said that he had the same situation last week.
Another argument for not using UUIDs as Primary Keys.
I was told many times that Java primitives are better and faster than objects, but I haven’t found any benchmarks for that. So I made my own. I was trying to check how much slower it is to use objects like Integer, Long or Double instead of int, long or double. Continue reading