[英]MYSQL COLLATE Performance
I have a table called users
with a column firstname
and with collation utf8_bin
我有一个名为
users
的表,其中包含列firstname
和collation utf8_bin
I want to know what happens under the hood when I execute an query like 我想知道在我执行查询时会发生什么
SELECT * FROM `users` `a` WHERE `a`.`firstname` = 'sander' COLLATE utf8_general_ci
the column firstname
isn't an index, what happens with the performance when the command executed? 列
firstname
不是索引,执行命令时性能会怎样?
And what if the default collation was utf8_general_ci
and the query is executed without COLLATE
如果默认排序规则是
utf8_general_ci
并且在没有COLLATE
的情况下执行查询,该怎么办?
I want to know the impact it has on a big table (8 million+ records) 我想知道它对一张大桌子的影响(800万+记录)
In this case, since the forced collation is defined over the same character set as the column's encoding, there won't be any performance impact. 在这种情况下,由于强制归类是在与列编码相同的字符集上定义的,因此不会对性能产生任何影响。
However, if one forced a collation that is defined over a different character set, MySQL may have to transcode the column's values (which would have a performance impact); 但是,如果强制使用不同字符集定义的排序规则,MySQL可能必须对列的值进行转码(这会对性能产生影响); I think MySQL will do this automatically if the forced collation is over the Unicode character set, and any other situation will raise an "illegal mix of collations" error.
我认为如果强制整理超过Unicode字符集,MySQL将自动执行此操作,并且任何其他情况都会引发“非法混合排序”错误。
Note that the collation recorded against a column's definition is merely a hint to MySQL over which collation is preferred; 请注意,根据列的定义记录的排序规则仅仅是对MySQL的提示,首选排序规则; it may or may not be used in a given expression, depending on the rules detailed under Collation of Expressions .
它可能会也可能不会在给定的表达式中使用,具体取决于表达式排序规则中详细说明的规则 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.