I'm planning on using client provided UUID's as the primary key in several tables in a MySQL Database.
I've come across various mechanisms for storing UUID's in a MySQL database but nothing that compares them against each other. These include storage as:
- BINARY(16)
- CHAR(16)
- CHAR(36)
- VARCHAR(36)
- 2 x BIGINT
Are there any better options, how do the options compare against each other in terms of:
- storage size?
- query overhead? (index issues, joins etc.)
- ease of inserting and updating values from client code? (typically Java via JPA)
Are there any differences based on which version of MySQL your running, or the storage engine? We're currently running 5.1 and were planning on using InnoDB. I'd welcome any comments based on practical experience of trying to use UUIDs. Thanks.