在utf8_general_ci和utf8_unicode_ci之间,在性能方面有什么不同吗?
当前回答
这篇文章描述得很好。
简而言之:utf8_unicode_ci使用Unicode标准中定义的Unicode排序算法,而utf8_general_ci是一种更简单的排序顺序,会导致“不太准确”的排序结果。
其他回答
根据这篇文章,在MySQL 5.7上使用utf8mb4_general_ci而不是utf8mb4_unicode_ci有相当大的性能优势: https://www.percona.com/blog/2019/02/27/charset-and-collation-settings-impact-on-mysql-performance/
简单来说:
如果您需要更好的排序顺序-使用utf8_unicode_ci(这是首选方法),
但是如果您对性能非常感兴趣,可以使用utf8_general_ci,但要知道它有点过时了。
性能方面的差异非常微小。
一些细节(PL)
正如我们可以在这里(Peter Gulutzan)读到的,排序/比较波兰字母“Ł”(L与笔画- html esc: Ł)(小写:“ova”- html esc: ł) -我们有以下假设:
utf8_polish_ci Ł greater than L and less than M
utf8_unicode_ci Ł greater than L and less than M
utf8_unicode_520_ci Ł equal to L
utf8_general_ci Ł greater than Z
在波兰语中,字母Ł在字母L之后,在字母m之前,没有哪个编码更好或更差——这取决于你的需要。
请参阅mysql手册,Unicode字符集部分:
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.
因此,总的来说,utf_general_ci使用的比较集比utf_unicode_ci更小,更不正确(根据标准),后者应该实现整个标准。general_ci集将更快,因为要做的计算更少。
这篇文章描述得很好。
简而言之:utf8_unicode_ci使用Unicode标准中定义的Unicode排序算法,而utf8_general_ci是一种更简单的排序顺序,会导致“不太准确”的排序结果。
推荐文章
- 如何停止mysqld
- 检查MySQL表是否存在而不使用“select from”语法?
- 从NOW() -1天选择记录
- 从表中选择1是什么意思?
- 数据库性能调优有哪些资源?
- 如何更改表的默认排序规则?
- MySQL foreign_key_checks是否影响整个数据库?
- 设置NOW()为datetime数据类型的默认值?
- 编码字符串为UTF-8
- 在MySQL中Datetime等于或大于今天
- 删除MySQL中的主键
- 我如何在MySQL中添加更多的成员到我的enum类型列?
- 相当于varchar(max)在MySQL?
- PHP与MySQL 8.0+错误:服务器请求身份验证方法未知的客户端
- laravel5“LIKE”对等物(雄辩的)