0

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?

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.