What's the difference between utf8_general_ci and utf8_unicode_ci?

后端 未结 8 1351
暗喜
暗喜 2020-11-22 01:38

Between utf8_general_ci and utf8_unicode_ci, are there any differences in terms of performance?

8条回答
  •  轮回少年
    2020-11-22 02:16

    See the mysql manual, Unicode Character Sets section:

    For any Unicode character set, operations performed using the _general_ci collation are faster than those for the _unicode_ci collation. For example, comparisons for the utf8_general_ci collation are faster, but slightly less correct, than comparisons for utf8_unicode_ci. The reason for this is that utf8_unicode_ci supports mappings such as expansions; that is, when one character compares as equal to combinations of other characters. For example, in German and some other languages “ß” is equal to “ss”. utf8_unicode_ci also supports contractions and ignorable characters. utf8_general_ci is a legacy collation that does not support expansions, contractions, or ignorable characters. It can make only one-to-one comparisons between characters.

    So to summarize, utf_general_ci uses a smaller and less correct (according to the standard) set of comparisons than utf_unicode_ci which should implement the entire standard. The general_ci set will be faster because there is less computation to do.

提交回复
热议问题