uuid_short() creates a bitwise conglomeration of the server identifier, a rather static time component, and a sequential increase in the 24-bit integer. These bits are filled into an 8-byte integer. The time component is based on server load time.
uuid() creates a hexadecimal string that represents the UUID of version 16 bytes of version1. Version 1 UUID is a bitwise conglomeration of the server identifier, the current timestamp, several bytes that come into play if you generate identifiers in a hyper-stream, and several service bits.
To answer your question: uuid_short provide the uniqueness of time and space that competes with uuid ? The answer is no. The fact is that the server identifier in uuid_short is only one byte. Therefore, if you have 256 or more servers, at least some of them will have the same node identifier, which means that you are losing uniqueness in space. For comparison, the server identifier in UUID version 1 is 6 bytes long, which actually kills the likelihood of duplication for all but the largest of the corporate server farms :)
Best question: is uuid_short . You could see collisions with identifiers if you:
- Generate over 16 million IDS from one server in a short time. ***
- Download servers with the same server ID at the same time and exchange data between them.
- System clock script and server reboot.
The second problem seems unlikely for most people, but the first is worth exploring before you commit yourself to making uuid_short basis of your keys.
*** Based on the mysql uuid_short for uuid_short , it seems like you will see collisions if you created more than 16 million identifiers while running a single server. But that would be stupid. The mysql docs say you're fine if you don't generate 16 million identifiers per second. This means that they must beat some bits in the timestamp if you run out of 16 million consecutive identifiers. I have not tested this.
source share