欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

mysql varchar varbinary_mysql varbinary vs varchar

发布时间:2023/12/10 34 豆豆
生活随笔 收集整理的这篇文章主要介绍了 mysql varchar varbinary_mysql varbinary vs varchar 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

Andomar,

我们使用5.0.5版.所有mysql版本都忽略尾随空格以进行比较.从手册:

All MySQL collations are of type

PADSPACE. This means that all CHAR and

VARCHAR values in MySQL are compared

without regard to any trailing spaces.

This is true for all MySQL versions,

and it makes no difference whether

your version trims trailing spaces

from VARCHAR values before storing

them

此外,mysql认为在索引中有/无尾随空格的文本是重复的:

For those cases where trailing pad

characters are stripped or comparisons

ignore them, if a column has an index

that requires unique values, inserting

into the column values that differ

only in number of trailing pad

characters will result in a

duplicate-key error. For example, if a

table contains ‘a’, an attempt to

store ‘a ‘ causes a duplicate-key

error.

而且,我们绝对需要关键字索引.所以,我想我们有两个选择:varbinary或text.我们将评估“text”的性能,以及varbinary的多字节功能.

总结

以上是生活随笔为你收集整理的mysql varchar varbinary_mysql varbinary vs varchar的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。