援引官方文档 Mysql document
For any Unicode character set, operations performed using the xxx_general_ci
collation are faster than those for the xxx_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.
译文
对于任何unicode字符,xxx_general_ci比xxx_unicode_ci速度快。因为xxx_unicode_ci支持类似扩展的映射。扩展的意思是一个字符等于多个字符的组合。比如在德语中,ß等于ss。xxx_unicode_ci也支持收缩和可忽视字符。xxx_general_ci是传统的校对规则,它不支持扩展、收缩、可忽视字符。它只会一个字符一个字符的比较。
总结
综上所述,xx_unicode_ci实现了unicode标准,支持扩展、可忽视字符等,由于准确性高,所以速度“相对慢”,不过根据现有cpu的性能,已经感觉不出“相对慢”。
xx_general_ci相对古老,是utf8的默认校对规则,由于不是那么准确,所以速度快。由于是utf8的默认校对规则,所以,我们推荐使用这种校对规则,在开发中,会省去很多麻烦。
参考
标签:字符,ci,utf8,xxx,general,unicode,mysql From: https://blog.51cto.com/u_15561616/6571874