Mysql newspaper row Size too large 65535 reasons and solutions _mysql

Source: Internet
Author: User

error message: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535

When a field type is text for a MySQL table plug-in, or if you modify a field type of text, the above error is reported. In fact, I do not understand the reasons for this error is not very deep, give me some of the explanations I found

The effect is that the data table has a set length of 64K field index, when the table in the field (do not know is the name of the field or what) can not exceed this length, 65,535 is for the entire table is not large-field type of bytes sum. (found on the internet)

My own understanding (and not very clear, you point out):

My understanding with the last sentence to find the meaning of the same, is not large-type fields of the bytes sum of more than 64K, the bytes sum of this field is what? I still when he understood the name of the field of the total sum of the long. Non-large segment refers to those fields, I think it is varchar field Type field, their name sum is greater than 64K, beyond the MySQL retrieval size storage space will be an error.

varchar Let me simply say, before the old version of version 5 varchar The maximum number of characters is 255 (the argument is not scientific interested in their own check), in 5 version after varchar is variable length, is the actual storage data to partition the amount of storage space occupied, For example, there are 50 of the data in the varchar type, and the storage space it occupies may be 51 and one is a placeholder for recording how many characters are saved. (perhaps not the name of the field for 64k, but this field records too much of the length of the position, exceeding the value of 64k) that is, you see for yourself whether your data table uses varchar field types too much.

VarChar is really used too much, how to do it, in fact, the statement of the above error has instructions, you can turn the property to text or blobs. You can try it yourself.

Why are there so many varchar on my datasheet? Because he is the actual length of the feeling can save a bit of storage space, such as to varchar (300) but I actually saved 10 words in this field, it is actually only occupied 11 characters storage space, up to 300 characters.

My solution:

Set the field of varchar (n) in the table to a property that is less than 255, and modify the property to Tinytext. Tinytext always occupies 255 characters at store time. Is fixed to occupy, the maximum can save the character also only 255. So if varchar (n) has a very small n value, it can be replaced with Tinytext. Char This everyone think about whether you can use it.

The above is a small series to introduce the MySQL newspaper row size too large 65535 reasons and solutions, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.