Maximum Number of Fields in a Form

Maximum Number of Fields in a Form

You may have occasionally encountered the following error notice while establishing custom fields:

Too big of a row. Without include BLOBs, the maximum row size for the used table type is 65535. For more information, consult the manual. Certain columns need to be converted to TEXT or BLOBs.

What does it mean?

It simply signifies that you have used up the allotted number of fields for that particular form/doctype. So, how many fields can there be at their most?

The maximum effective number of columns for a given table may be fewer than the 4096 hard limit for tables in MySQL. The precise limit is determined by a number of interrelated factors.

No matter the storage engine, a table's maximum row size is 65,535 bytes. This limit may be further restricted by storage engines, lowering the actual maximum row size.

The maximum row size limits the number of columns (and possibly their size) because all columns' combined lengths cannot be greater than this amount (65,535 bytes). For instance, utf8mb3 characters require up to 3 bytes each character, therefore the server must allocate 140 3 = 420 bytes per value for a VARCHAR(140) column. As a result, a table can only have 156 of these columns, or 65,535 / 420.

VARCHAR(140) type columns of the "Data," "Link," "Select," "Dynamic Link," "Password," and "Read Only" field kinds are created in the Frappe framework. With the system, you may therefore generate about 156 of these columns.

Solution: You can make some adjustments to the system to add extra fields.

  1. Change some of the fields to be of the "Text," "Small Text," "Text Editor," or "Code" type. Due to the fact that their contents are kept independently of the remainder of the row, BLOB and TEXT columns in MySQL count from one to four plus eight bytes each toward the row-size limit. By switching to those field types, some room will be made available for the insertion of extra fields.

  2. When creating fields, change the default value of 140 for the "Length" property to a smaller number. Based on this characteristic, the system determines the length of VARCHAR and allocates space for those columns. Smaller Length results in the addition of more fields.