Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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? This is critical for the app.

Thanks.

share|improve this question
add comment

3 Answers

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

Finally I found this page: http://download.oracle.com/docs/cd/E17952_01/refman-5.5-en/innodb-compression-usage.html

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

innodb_file_per_table
innodb_file_format = Barracuda

Then I ALTER my table with this command through phpMyAdmin:

ALTER TABLE nombre_tabla
 ENGINE=InnoDB
 ROW_FORMAT=COMPRESSED 
 KEY_BLOCK_SIZE=8; 
 SHOW WARNINGS;

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

share|improve this answer
add comment

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 lover 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.

share|improve this answer
add comment

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:

http://dev.mysql.com/doc/refman/5.0/en/column-count-limit.html

And here's everything to know about text fields:

http://dev.mysql.com/doc/refman/5.0/en/blob.html

share|improve this answer
    
Thanks @korkman for your answer, my fields were already defined as text when the problem ocurred. I'm going to watch your link suggestions. –  Memochipan Nov 2 '11 at 0:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.