问题
I have this error:
Row size too large (> 8126). Changing some columns to
TEXT
orBLOB
or usingROW_FORMAT=DYNAMIC
orROW_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