mysql collation 校对规则 utf8_general_ci 与 utf8_unicode_ci的区别

援引官方文档 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 ssutf8_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的默认校对规则,所以,我们推荐使用这种校对规则,在开发中,会省去很多麻烦。

参考

击打开链接

点击打开链接

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值