Cannot add field…row size…greater than maximum allowed size

微笑、不失礼 提交于 2019-12-07 15:34:30

Some MySQL queries create internal temporary tables to hold partial results.

As of MySQL 5.7.6, the default storage engine for internal temporary tables is InnoDB, which has a pretty small limit on row size, as you can see (though BLOB/TEXT columns can go beyond that limit).

You can go back to the old pre-5.7 default storage engine for internal temporary tables:

 internal_tmp_disk_storage_engine=MyISAM

This is the workaround mentioned in this bug: "Bug #77398 row size too large in mysql 5.7 query"

Please show us SHOW CREATE TABLE. I'll bet you have lots of columns declared VARCHAR(255). I'll also bet that most of those columns will never need 255 characters. Shrink them.

If that does not suffice, change a few to be TEXT; the data will be stored off-page and not impact the 8K limit as badly.

If that does not suffice, we can talk about "vertical partitioning". At that point, please show us the query that precipitated the error. If you are doing SELECT *, change it to specify only the columns you really need.

Do not use MyISAM, that is a step backward. And it is going away in the next version, so a future migration will be hurt.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!