mysql存储大数据时,Row size too large
2019-01-23 20:45
459 查看
[code]2019-01-23 16:36:04 [ERROR] - JDBCExceptionReporter.logExceptions - 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. 2019-01-23 16:36:04 [ERROR] - AbstractFlushingEventListener.performExecutions - Could not synchronize database state with session org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137) at cn.kx.lj.core.orm.HibernateDBServcieImpl$TranHibernateTemplate.doCall(HibernateDBServcieImpl.java:56) at cn.kx.lj.core.orm.HibernateDBServcieImpl.update(HibernateDBServcieImpl.java:481) at cn.kx.lj.db.dao.BaseDao.update(BaseDao.java:105) at cn.kx.lj.gameserver.sys.SystemInfo$1.doIo(SystemInfo.java:340) at cn.kx.lj.core.async.AsyncOperation.execute(AsyncOperation.java:72) at cn.kx.lj.core.async.AsyncOperation$1.run(AsyncOperation.java:63) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
【导致问题的原因】
原因是因为mysql-innodb是按照page存储数据的,每个page max size是16K,然后每个page两行数据,所以每行最大8K数据。如果你的字段是blob之类的话,会存储在page之外的溢出区里。
但是innodb默认的approach(羚羊)存储格式会把每个blob字段的前864个字节存储在page里,所以你的blob超过一定数量的话,单行大小就会超过8k,所以就报错了。
【解决思路】
解决方式是使用innodb的Barracuda(梭鱼)存储格式。这种格式对blob字段的处理方式是在page里面只存储一个20byte大小的指针,其他完全存在溢出区,所以轻易不会超过8K.
解决办法:
根据提示首先修改:
alter table t_info ROW_FORMAT=DYNAMIC;
如果提示warnings可以使用
show warnings; 查看具体警告
如果修改完还不生效:
1.SET GLOBAL innodb_file_per_table=1
2.SET GLOBAL innodb_file_format=Barracuda; //Barracuda为梭鱼格式
3.重新建表
相关文章推荐
- Mysql 导入psc 文件时,数据列过多,提示Row size too large(>8126)
- MySQLSyntaxErrorException: Row size too large 转摘自:https://confluence.atlassian.com/display/CONFKB/MySQLSyntaxErrorException%3A+Row+size+too+large
- Mysql_大字段问题Row size too large.....not counting BLOBs, is 8126.
- [MySQL 错误]ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not
- mysql 主从同步故障解决 Error 'Row size too large (> 8126).
- MySql 5.6异常处理: Row size too large (> 8126)
- [MySQL 错误]ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not
- MySql “Row size too large (> 8126)” 亲测解决
- Mysql 报Row size too large 65535 的原因及解决方法
- Mysql [Err] 1118 - Row size too large
- MySQL报错 Mysql Row Size too large (>8126) 和 Unknow Table Engine InnoDB 解决方案
- Mysql [Err] 1118 - Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535.
- Mysql MySQLSyntaxErrorException Row size too large
- mysql 1118 Row size too large 错误
- mysql 报错:Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65
- MySQL Row size too large (> 8126) 以及ROW_FORMAT=COMPRESSED requires innodb_file_format > Antel 的解决办法
- MySQL Database Error: Row size too large.
- MySql “Row size too large (> 8126)”
- Packet for query is too large(mysql写入数据过大)
- Packet for query is too large(mysql写入数据过大)