MySQL Database row overrun

Source: Internet
Author: User

Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. Some columns to TEXT or BLOBs



[Email protected] 03:54: [test]> CREATE table t4 (c int, C2 char (+), C3 varchar (21813)) Charset=utf8;

ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. Some columns to TEXT or BLOBs

[Email protected] 03:55: [test]> CREATE table t4 (c int, C2 char (+), C3 varchar (21812)) Charset=utf8;

Query OK, 0 rows affected (0.04 sec)


If the character type is GBK, each character can be up to 2 bytes, and the maximum length cannot exceed 32766.

If the character type is UTF8, each character can be up to 3 bytes and the maximum length cannot exceed 21845.


The maximum value of n here is (65535-1-2-4-30*3)/3=21812

The reason for minus 1 is that the actual row storage starts with the second byte ';

The reason for minus 2 is that the 2 bytes of the varchar header represent the length;

The reason for minus 4 is that the int type C accounts for 4 bytes;

The reason for reducing 30*3 is that char (30) occupies 90 bytes and the encoding is UTF8.


MySQL's Vachar field type, although the maximum length is 65535, but is not able to save so much data, up to 65533 (do not allow non-empty fields when), when the non-empty field is allowed only to 65532.


This article from the "Clear Sky" blog, declined reprint!

MySQL Database row overrun

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.