SQL Error (1118): row size is too large. Maximum row size for table type used, not counting BLOB

I created one MySQL database table. I have to create 195 columns in one table. I have to provide data types from 190 columns, this is VARCHAR and 5 column data types is text. Each column has a length of 500.

Actually, I want to create 1000 columns in one database table, and I want to use the VARCHAR data type in each column of the table. Now when I create new columns in the database table. I get this error:

SQL Error (1118): row size is too large. The maximum row size for the type of table used, not counting the BLOB, is 65535. This includes storage overhead, check the manual. You must change some columns to TEXT or BLOB

+4
source share
1 answer

You have a bad database design.

The maximum row size with MySQL = 65,535 bytes.

Assuming 1 byte per character 500 X 1000 = 50,000 bytes per line, which approaches 65,535.

For VARCHAR (L) using latin1, 1 byte per column is required to store the length of L, so now we are at 501,000.

VARCHAR, , . , utf8 .

500 X 4 X 1000 = 2 000 000 (3 char + 1 )

MySQL MySQL .

, .

+4

All Articles