Home  >  Article  >  Database  >  MYSQLBLOB字段大小以及个数的限制测试。_MySQL

MYSQLBLOB字段大小以及个数的限制测试。_MySQL

WBOY
WBOYOriginal
2016-06-01 13:13:311261browse

测试结论
mysql版本 5.1
表类型: innodb, row_format=compact (这是默认的行格式)

插入超过10个blob, blob的数据量很小(插入超过10个blob, blob的数据量很大(>768字节), 插入失败:报 Got error 139 from storage engine。

注意,如果mysql服务器版本是5.1, innodb_file_format选项不存在, 也就无从谈起Barracuda格式。 设置row_format=dynamic也是没意义的。

mysql版本 5.5
表类型: innodb, row_format=compact (这是默认的行格式)
插入超过10个blob, blob的数据量很大(>768字节), 插入失败:报 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.

表类型: innodb, row_format=dynamic (这是innodb的新文件存储格式Barracuda所支持的行格式)
插入超过10个blob, blob的数据量很大(>768字节), 插入成功

备注:
1) 实际测试测试我用的每个字段长度都是100K+
2) 对于mysql5.5, 虽然支持Barracuda。但是默认使用的还是老的格式:Antelope
除非在mysql的配置里面my.cnf修改:
innodb_file_per_table = 1
innodb_file_format = Barracuda
或者set global 命令动态的修改:
SET GLOBAL innodb_file_format=barracuda;
SET GLOBAL innodb_file_per_table=1;

注意:
1) 修改后的innodb_file_format格式, 只影响后续创建的表。 也就是后续创建的表,可以支持把row_format设为dynamic
2) SET GLOBAL 只是在mysql服务器运行期间有效,重启后innodb_file_format还原为原来的格式。
3) 判断一个表是否支持超过10个blob的字段的简单办法:
show table status like 't1' /G
查看 Row_format , 如果是Compact, 必定不支持, 如果是dynamic, 则支持。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn