MySQL 1118: Row size too large.

  1. Check the Table Structure: Start by examining the columns and their data types to identify any unnecessarily large columns. Use the following command to describe the table structure:



DESCRIBE yourtablename;

  1. Check Row Format: Determine the row format of your table. If it's not dynamic, changing it might help. Use this query to check the row format:



SELECT TABLENAME, ROWFORMAT FROM INFORMATIONSCHEMA.TABLES WHERE TABLESCHEMA = 'yourdatabasename' AND TABLENAME = 'yourtable_name';

If the row format is not DYNAMIC, consider changing it with:

ALTER TABLE yourtablename ROW_FORMAT=DYNAMIC;

  1. Adjust innodblogfilesize: If the row size is indeed large due to the nature of your data, you might need to increase the `innodblogfilesize` in your MySQL configuration file (`my.cnf` or `my.ini`), which requires a server restart:



First, check the current value with:

SHOW VARIABLES LIKE 'innodblogfile_size';

To change the value, add or modify the following line in your MySQL configuration file and restart the MySQL service:

innodblogfile_size = 512M

  1. Optimize and Normalize Data: Consider normalizing the table by splitting it into two or more tables and linking them with foreign keys. Use smaller or more appropriate data types for the columns.



  1. Modify Large Columns: If certain columns are declared with large sizes that are rarely utilized, consider reducing their size. For VARCHAR columns that are excessively large, reduce their size based on the actual data need:



ALTER TABLE yourtablename MODIFY COLUMN columnname VARCHAR(newsize);

  1. Convert Longtext/Blob Columns: If your table contains LONGTEXT or BLOB data types, consider converting them into MEDIUMTEXT or TEXT if the size of the data stored in these columns is within the limits of these types.



  1. Check and Increase innodbstrictmode: Sometimes, disabling `innodbstrictmode` temporarily can allow certain ALTER TABLE operations to proceed, but be cautious as this might lead to data truncation. Check the current mode:



SHOW VARIABLES LIKE 'innodbstrictmode';

To change it:

SET GLOBAL innodbstrictmode = OFF;

Remember to turn it back on after making your changes.

  1. Compress Data: If applicable, consider enabling compression for the table:



ALTER TABLE yourtablename ROW_FORMAT=COMPRESSED;

  1. Check for Updates: Ensure your MySQL version is up-to-date as newer versions may have improvements or fixes for issues related to row size limitations.



Note: Always back up your database before making structural changes or updates.

Never debug

MySQL

manually again

Let Dr. Droid create custom investigation plans for your infrastructure.

Start Free POC (15-min setup) →
Automate Debugging for
MySQL
See how Dr. Droid creates investigation plans for your infrastructure.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid