Does MySQL mixed utf8 utf8mb4 have any advantages over pure utf8mb4?
巴扎黑
巴扎黑 2017-06-22 11:54:49
0
1
992

There are too many tables, only nicknames and comments are set to utf8mb4,
config, tag, router, etc. do not use utf8mb4 at all, they are still utf8
This kind of utf8 utf8mb4 hybrid
will affect search, index and log Does the record matter?
Is this method faster than pure utf8mb4? Is it stable?
Do you need to modify any configuration in mysqld configuration and optimize utf8mb4

PHP code DB_CHARSET sets utf8mb4, will it affect uft8 data?

巴扎黑
巴扎黑

reply all(1)
阿神

There are not many advantages
Because utf8mb4 only uses 4 bytes to store special characters such as emoji
Other times, the performance is the same as MySQL's utf8 character set. Storing Chinese characters is still 3 bytes

(Because the implementation of the maximum length of a single character in the MySQL utf8 character set is wrong, so the utf8mb4 character set came out. In fact, this utf8mb4 is the standard utf8)

Of course, you need to avoid using char and use varchar instead, because the char column type of mysql is under utf8mb4. In order to ensure that all data is stored, char will occupy the number of bytes * 4 characters (the char column type of mysql utf8 will occupy the number of bytes (number of characters * 3) to ensure sufficient space allocation. Therefore, it is recommended to use variable length varchar to save space. The storage space consumed by variable length is: the number of bytes required for actual storage + 1 or The length expressed in 2 bytes.

In addition, for pure English character columns, you can also consider varbinary (variable-length binary) and binary columns (suitable for fixed-length English characters, such as password hashes). The performance is slightly better than varchar, because this stores binary data

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template