From the documents - Table Column-Count and Row-Size Limits:
Every table (regardless of storage engine) has a maximum row size of 65,535 bytes. Storage engines may place additional constraints on this limit, reducing the effective maximum row size.
The maximum row size constrains the number (and possibly size) of columns because the total length of all columns cannot exceed this size. For example, utf8 characters require up to three bytes per character, so for a CHAR(255) CHARACTER SET utf8 column, the server must allocate 255 × 3 = 765 bytes per value. Consequently, a table cannot contain more than 65,535 / 765 = 85 such columns.
Storage for variable-length columns includes length bytes, which are assessed against the row size. For example, a VARCHAR(255) CHARACTER SET utf8 column takes two bytes to store the length of the value, so each value can take up to 767 bytes.
So, defining a single VARCHAR(65535)
column, effectively limits you to a single column on the row (assuming you have filled it up).
All this apart from the fact that such a large size is completely wrong for some types of data - if you have a phone number column which may contain local and international numbers, you may choose to use a VARCHAR
field to do so, but setting it to anything over 20 may well meaningless (I am being generous).
See this answer from Bill Karwin which also indicates possible performance penalties if temporary tables get generated with unnecessarily long VARCHAR
fields (to do with conversion of such fields to CHAR
and back again - see the post for details).