The logical storage structure of InnoDB is shown in the following figure :
1).Table space
The table space is the highest level of the logical structure of the InnoDB storage engine. If the user enables the parameter innodb_file_per_table (opened by default in version 8.0), each table will have a table space (xxx.ibd), and a mysql instance can correspond to multiple table spaces for storing records, indexes and other data.
2). Section
Segment, divided into data segment (
Leaf node segment
), index segment (
Non-leaf node segment
), rollback segment
(
Rollback segment
),
InnoDB
is an index organization table, the data segment is
the leaf node of the
B+ tree, and the index segment is
the B+ tree
non-leaf nodes. A segment is used to manage multiple
Extents
(areas).
3). District
Area, the unit structure of the table space, the size of each area is
1M
. By default,
the InnoDB
storage engine page size is
16K
, that is
, there are
64
consecutive pages in an area.
4). Page
Page is
the smallest unit of
InnoDB storage engine disk management, and the default size of each page is
16KB . In order to ensure the continuity of pages, the InnoDB storage engine applies for 4-5 areas from the disk each time.
5).
OK
row,
InnoDB
storage engine data is stored by row.
In a row, there are two hidden fields by default:
Trx_id
: Every time a record is changed, the corresponding transaction
id will be
assigned to the
trx_id
hidden column.
Roll_pointer: Every time a reference record is changed, the old version will be written into the undo log, and then
The last hidden column is equivalent to a pointer, and the information before the modification of the record can be found through it.