3 ms·
The next problem you'll likely encounter after switching to utf8mb4 is the relatively tiny maximum index key length in InnoDB - even though the strings are vari
by blaisio 9y ago
The next problem you'll likely encounter after switching to utf8mb4 is the relatively tiny maximum index key length in InnoDB - even though the strings are variable length, for the utf8 4 encoding MySQL will multiply the length of the string by 4 when checking against this limit.
If your data model layer supports it, it's often better to just use raw binary instead of any particular encoding. The main features utf8mb4 provides are validation and sorting. Most people are just using an ORM and use Unicode internally in an application, so validation of the encoding is nice, but not essential. And for most applications it doesn't make sense to sort arbitrary utf8 strings in the database layer. (Sorting Unicode strings in general is very complicated, and 99% of the time it's not something you really need.)