Description of InnoDB tablespace, segments, and zones
1. The tablespace is the highest level of the logic structure of the InnoDB Storage engine. All data is stored in the tablespace. By default, the InnoDB Storage engine has only one tablespace ibdata1, that is, all data is stored in this tablespace. If the innodb_file_per_table parameter is enabled, data in each table can be stored in a single tablespace.
If the innodb_file_per_table parameter is enabled, only data, indexes, and buffer Bitmap pages are stored in the tablespace memory of each table. Other data, such as undo log, Buffer Index page insertion, and system transaction information are inserted, secondary write buffering is stored in the original shared tablespace.
2. Common segments include data segments, index segments, and rollback segments.
Data Segment: leaf node of B + tree.
Index segment: Non-leaf node of B + tree.
Rollback segment: rollback segment, which manages undo log segment.
3. A zone is a space composed of consecutive pages, and its size is fixed to 1 MB. By default, the size of the InnoDB Storage engine page is 16 KB, that is, there are 64 consecutive pages in a zone.
Create table test (
Col1 int not null auto_increment,
Col2 varchar (7000 ),
Primary key (col1)
);
Create a test table and set the Col2 field to varchar (7000) to ensure that up to two records can be stored on one page. The ls command shows that the tablespace is 96 kb by default.
View the mysql data directory:
Select @ datadir;
System ls-lh/var/lib/mysql/db_zhang/test. ibd
This article permanently updates link: https://www.bkjia.com/Linux/2018-03/151175.htm