MySQL – How Are Limits on Size of Columns Calculated

MySQLsize;

From the mysql docs,

1 – on joins,

The maximum number of tables that can be referenced in a single join is 61. This also applies to the number of tables that can be referenced in the definition of a view.

2 – row size

Every table (regardless of storage engine) has a maximum row size of 65,535 bytes

3 – on number of columns

There is a hard limit of 4096 columns per table

InnoDB permits up to 1000 columns.]

Is there an explanation of how these numbers have been calculated, or are these all constants assumed during system design?

Best Answer

  1. The 61 is probably arbitrary. If you have a 61-way JOIN, you have an awful schema.

  2. The row size limit is not quite right. What page is that on? It is ignoring that MEDIUM/LONGTEXT/BLOB fields are not included in that limit. (But, for that matter, I don't know where 64K-1 applies.) In InnoDB, there is an "about 8K" limit excluding TEXT, etc that can be pushed to off-block storage.

  3. The InnoDB limit was raised to 1017 recently. The 4096 limit smells like a 12-bit fields in the Handler (Engine-agnostic) code.

I like limits, too. Here are some more.