Question :
What does it mean when we say that an ENUM
has a charset of utf8mb4
, versus latin1
?
My understanding is that the ENUM
holds a numeric index (1, 2, 3, 4…) that identifies which of the ENUM
values (abc, def, ghi, jkl…).
If I use utf8mb4
for an ENUM
column, is the column using more storage than it would if I used latin1
?
Answer :
No difference.
ENUM
is stored as a 1- or 2-byte number, where 0 maps to the first item in your list. You deal with the column as a string, but the disk only sees a number.
2-bytes is used only when there are more than 255 options. There are some who shun the use of ENUM altogether; there are some who frown on more than a few options. I say use ENUM for a small, unlikely to change, list of options.
It may be possible to get charset or collation problems if you aren’t consistent in database and connection specifications.