All data in InnoDB is stored in database pages comprising a B-tree index (the clustered index or primary key index). The nodes of the index data structure contain the values of the key columns for each primary key value, plus the values of the remaining columns of that row. In some other database systems, a clustered index is called an “index-organized table”. Secondary indexes in InnoDB are also B-trees, containing pairs of values of the index key and the value of the primary key, which acts as a pointer to the row in the clustered index.
Variable-length columns are an exception to this rule. Such
columns, such as BLOB
and
VARCHAR
, that are too long to fit on a B-tree
page are stored on separately allocated disk
(“overflow”) pages. We call these “off-page
columns”. The values of such columns are stored on
singly-linked lists of overflow pages, and each such column has
its own list of one or more overflow pages. In some cases, all or
a prefix of the long column values is stored in the B-tree, to
avoid wasting storage and eliminating the need to read a separate
page.
The “Barracuda” file format provides a new option
(KEY_BLOCK_SIZE
) to control how much column
data is stored in the clustered index, and how much is placed on
overflow pages.