Row size too large (> 8126) can i just change InnoDB to MyISAM

戏子无情 提交于 2021-02-11 06:25:22

问题


I have this error:

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.

To solve this can i just change InnoDB to MyISAM?


回答1:


Yes, you could switch to MyISAM. But that is not necessarily a good idea:

  • MyISAM does not support transactions
  • MyISAM tables often need REPAIR after a crash

An InnoDB table can handle more than 8KB per row. Apparently you ran into the problem by having a dozen or more TEXT/BLOB columns? At most 767 bytes of a column is stored in the main part of the row; the rest is put in a separate block.

I think one ROW_FORMAT will put all of a big columns in a separate block, leaving behind only 20 bytes to point at it.

Another approach to wide rows is to do "vertical partitioning". That is, build another table (or tables) with a matching PRIMARY KEY and some of the big columns. It is especially handy to move sparsely populated column(s) to such a table, then have fewer rows in that table, and use LEFT JOIN to fetch the data. Also, if you have some column(s) that you rarely need to SELECT, then those are good candidates to move -- no JOIN needed when you don't need those columns.



来源:https://stackoverflow.com/questions/29534868/row-size-too-large-8126-can-i-just-change-innodb-to-myisam

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