The database for an application I manage use UUIDs. These UUIDs are stored as char(36)
with a utf8
character set. From a strict performance point of view, I know this is not optimal. The general recommendation seem to be to use a binary(16)
column for UUIDs. I cannot change the data type, but I can change the character set.
The characters in a UUID can be a digit 0 through 9, or letter a through f.
By changing the character set from utf8
to ascii
, the total size of all indexes for the database will probably be reduced by several gigabytes.
The application connects to the database and explicitly sets character encoding and connection collation in the connection string : characterEncoding=utf8&connectionCollation=utf8
.
What will I have to do (if anything at all) to ensure a safe "conversion" from utf8 to ascii for the UUIDs?