MySQL Forums :: InnoDB :: utf8 and utf8mb4 performance difference


Advanced Search

Re: utf8 and utf8mb4 performance difference
Posted by: Xing Zhang ()
Date: September 20, 2016 08:38PM

If you only want to store characters in table, there is no performance difference between utf8 and utf8mb4 if the characters are in BMP. But if you also want to store SMP characters, you have no choice, only utf8mb4 can do that. And I also believe the performance difference is little.

But I'm sure you might want to use collations to do sorting. We need to figure out first what kind of collation you are using. For both utf8 and utf8mb4, there are 2 kinds of collations. One is the "general way", the sort order of characters are pre-defined in numbers of character tables. Another is the "UCA way", the sort order is defined by DUCET (default unicode collation element table) which is provided by Unicode committee.

By MySQL 5.7, the default collation of utf8 is utf8_general_ci and the default collation of utf8mb4 is utf8mb4_general_ci. Both of these 2 collations can ONLY sort characters in [U+0000, U+FFFF]. (Yes, utf8mb4's collation can only sort characters in BMP)

Both these 2 collations use the "general way", so there is no performance difference between them. But if you compare utf8mb4_unicode_520_ci and utf8mb4_general_ci (or utf8_unicode_520_ci vs utf8_general_ci), I think there should have some performance difference. I don't have the data, but it might be 10-15% slower doing sorting. The difference is because the "general way" maps character's sorting weight to character 1:1, but the UCA's weight to character is N:1 to get more accurate result.

Options: ReplyQuote


Subject Views Written By Posted
utf8 and utf8mb4 performance difference 622 hua kai 09/09/2016 07:25AM
Re: utf8 and utf8mb4 performance difference 454 Rick James 09/10/2016 10:48PM
Re: utf8 and utf8mb4 performance difference 344 hua kai 09/12/2016 08:55PM
Re: utf8 and utf8mb4 performance difference 303 Rick James 09/13/2016 04:07PM
Re: utf8 and utf8mb4 performance difference 320 hua kai 09/18/2016 12:20AM
Re: utf8 and utf8mb4 performance difference 289 Peter Brawley 09/18/2016 01:40PM
Re: utf8 and utf8mb4 performance difference 302 hua kai 09/19/2016 02:14AM
Re: utf8 and utf8mb4 performance difference 429 Xing Zhang 09/20/2016 08:38PM
Re: utf8 and utf8mb4 performance difference 299 hua kai 09/25/2016 01:20AM
Re: utf8 and utf8mb4 performance difference 287 Rick James 09/30/2016 08:04PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.