问题描述
我有原始二进制数据的2K左右,我需要一个表来存储,但不知道是否要选择VARBINARY或BLOB类型。我已经通过在MySQL的文档的描述看,但没有发现任何合同和比较说明。我也读了VARBINARY只有255个字符的支持,但我成功地创建了一个VARBINARY(2048)领域,所以我有点糊涂了。
I have about 2k of raw binary data that I need to store in a table, but don't know whether to choose the Varbinary or Blob type. I have read through the descriptions in the MySQL docs but didn't find any contract and compare descriptions. I also read that varbinary only supports up to 255 characters, but I successfully created a varbinary(2048) field, so I'm a bit confused.
二进制数据不需要被索引,也不会需要在其上查询。是否有优势,使用一种比其他从PHP?
The binary data does not need to be indexed, nor will I need to query on it. Is there an advantage to using one type over the other from PHP?
谢谢!
推荐答案
VARBINARY
势必为255字节在MySQL 5.0.2及以下,以65KB的5.0.3以上。
VARBINARY
is bound to 255 bytes on MySQL 5.0.2 and below, to 65kB on 5.0.3 and above.
BLOB
势必65KB。
最后, VARBINARY
几乎是一样的 BLOB
(从什么可以存储在其中的观点) ,除非你想美元,MySQL的老版本p $ pserve兼容性。该说:
Ultimately, VARBINARY
is virtually the same as BLOB
(from the perspective of what can be stored in it), unless you want to preserve compatibility with "old" versions of MySQL. The MySQL Documentation says:
在大多数方面,你可以把一个 BLOB
列作为 VARBINARY
列可以像你一样大等等。
这篇关于VARBINARY VS斑点在MySQL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!