“This is the 8th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021”
Data page storage format
MySQL is the smallest unit when operating data data page, each data page default size 16 KB, a line of data stored in data page, page data split into many parts, roughly as follows: file header, the header data, minimum record, record, multiple rows of data, free space, the data page directory, and file the tail.
Among them, the file header occupies 38 bytes, the data page header occupies 56 bytes, the maximum record and the minimum record occupy 26 bytes, the size of the data line area is not fixed, the size of the free area is not fixed, the small size of the data page directory is not fixed, and the file tail occupies 8 bytes.
Table Spaces and data areas
For a disk data file such as IBD, on the physical level, a table space corresponds to data files on disks. A disk file of a tablespace contains many data pages. A tablespace contains too many data pages to be easy to manage. Therefore, the concept of extent is introduced in a tablespace. The 256 data areas are then divided into groups. For table Spaces, the first three data pages of the first data area of the first group of data areas are fixed and contain descriptive data.
- FSP_HDR data page: Holds the table space and some properties of this set of data areas
- IBUF_BITMAP data page: Stores some information about all the insert buffers in this set of data pages
- INODE data pages: Hold special information
Then the other groups of extents of the tablespace, the first two pages of the first extents of each group, hold special information
- XDES data page: Holds some attributes related to this set of data areas
The disk storage mode looks like this: To create those tables are corresponding table space, each table space is corresponding to the data on the disk file, there are many sets of data in table space area, a set of data area is 256 data area, each data area contains 64 pages, is 1 MB, and then the first set of data table space in the first three data page of the first data area, storage of special information; The first two data pages of the first data area of the other group data area of the tablespace also hold special information.