InnoDB Off-Page Storage
InnoDB limits the row size to a little under half a page so that at least two rows fit in one page. If a row is larger, InnoDB picks long variable-length columns (BLOB, TEXT, VARCHAR, VARBINARY, JSON), moves them to separate overflow pages, and leaves a pointer to their location in the clustered index row. This is called off-page storage (external storage).
Key Specs
| Item | Value |
|---|---|
| Row size that fits in a page | A little under half a page (about 8KB for a 16KB page) |
| Order of moving | Longest variable-length column first, until the row drops below the limit |
| Where it goes | Overflow pages (BLOB pages) in the same tablespace; large values chain pages together |
What stays in the row for DYNAMIC and COMPRESSED | Only a 20-byte pointer. Columns of 40 bytes or less always stay in the row |
What stays in the row for COMPACT and REDUNDANT | The first 768 bytes + a 20-byte pointer |
| Maximum row size (definition) | 65,535 bytes total column length. BLOB and TEXT count only the pointer size |
| Maximum size of one value | LONGBLOB and LONGTEXT: 4GB |
How It Works
Figure. What stays in the row by row format
block-beta
columns 6
t1["DYNAMIC row"]:2 a1["id, status, etc."]:2 p1["20B pointer"]:2
t2["COMPACT row"]:2 a2["id, status, etc."] b2["first 768B"] p2["20B pointer"]:2
t3["Overflow pages"]:2 c1["BLOB page"] c2["BLOB page"] c3["BLOB page"]:2
class t1,t2,t3 plain
class a1,a2 data
class b2 hot
class p1,p2 slot
class c1,c2,c3 muted
Diagram notes: A DYNAMIC row keeps only a 20B pointer in place of the long column, and the whole value goes into the chain of BLOB pages. A COMPACT row keeps the first 768B of the value in the row and sends only the rest to overflow pages. With several long columns, COMPACT takes 768 bytes of the row for each one, so fewer rows fit in a page, and it pays off little unless queries use only the leading part. That is why DYNAMIC has been the default since 5.7.
Read cost. Reading an off-page value requires finding the row and then reading the overflow pages separately, so I/O increases. A query that does not select the large column does not read the overflow pages. This is why you avoid SELECT *.
Indexes. BLOB and TEXT columns allow only prefix indexes with a specified prefix length. In DYNAMIC and COMPRESSED, the index key prefix is at most 3,072 bytes.
Common error. If many long VARCHAR columns exceed the limit even with only the part that must stay in the row, you get a Row size too large error. If the format is COMPACT, change it to DYNAMIC; if that still overflows, change some columns to TEXT or split the table.
Configuration and Checks
SHOW VARIABLES LIKE 'innodb_default_row_format';
SELECT TABLE_NAME, ROW_FORMAT FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE();
ALTER TABLE docs ROW_FORMAT = DYNAMIC; -- rebuilds the table
Comparison with Other DBMSs
| InnoDB | PostgreSQL | Oracle | SQL Server | |
|---|---|---|---|---|
| Name | off-page storage | TOAST | LOB | LOB, row overflow |
| Compression | Only in the COMPRESSED row format | Compressed first by default | SecureFiles option | Values off the row are not compressed |
| Where it goes | Same tablespace | Separate TOAST table | LOB segment | Another allocation unit in the same file |
In the Articles
NOTE The threshold size can vary with the page size and version.