• 4
name Punditsdkoslkdosdkoskdo

Issue with maximum row size in MySQL

I have a problem with MySQL, I have a table with many text fields. When I try to store some data I obtain this error.

Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs

The text that I store in each field is not too long, only a few paragraphs in each one.

What can I do?

Well, do as mysql says: convert big fields from varchar to text or blob (ALTER TABLE). text fields behave much like varchar (indices needs prefix length, but nevertheless work), but are stored separately.

This reference tells you the exact limits of every stock mysql table engine:

And here's everything to know about text fields:

  • 0
Reply Report

You may want to take a look at this article which explains a lot about MySQL row sizes. It's important to note that even if you use TEXT or BLOB fields, your row size could still be over 8K (limit for InnoDB) because it stores the first 768 bytes for each field inline in the page. The simplest way to fix this is to use the Barracuda file format with InnoDB. This basically gets rid of the problem altogether by only storing the 20 byte pointer to the text data instead of storing the firs 768 bytes.

  • 0
Reply Report

Thanks for the people that answer. The links you posted were a very useful base to start learning.

Finally I found this page:

And I configured my.cnf adding these two lines in [mysqld] section:

innodb_file_format = Barracuda

Then I ALTER my table with this command through phpMyAdmin:

ALTER TABLE nombre_tabla

It is also possible use other settings that you can read in the link above, but these worked good for me.

  • 0
Reply Report


Related Questions

Trending Tags