I've studied and summarized how MySQL InnoDB pages works with underlying OS file system when accessing secondary storage.
Would you mind to confirm that my understanding is correct?
InnoDB
store table data (including indexes) ontablespace
- Each
tablespace
is stored to each file in.ibd
data file - A
tablespace
contains multiplepages
(I called thepage
asDB page
from now on) - Default
DB page
size is 16KB - A
DB page
loaded from secondary storage is inbuffer pool
- A
DB page
is data transfer unit betweenbuffer pool
and secondary storage - In terms of OS memory management, if memory page size is 8KB, then each
DB page
would be stored in 2 memory pages - Whenever InnoDB reads/writes a
DB page
from/to secondary storage, theDB page
which is composed of 2 memory pages are divided by OS file system block size and transfer based on the blocks - So, if file system block size is 4KB, then
DB page
are divided into 4 blocks and transferred from/to secondary storage - If secondary storage is HDD and its sector size is 512B, then the
DB page
is stored to/from 32 sectors - If secondary storage is SSD and its page size is 4KB, then the
DB page
is stored to/from 4 SSD pages (of course SSD write is more complicated because it has erase but overwrite) - In all the progress,
DB page
would or would not be stored in contiguous OS pages or sectors or SSD pages physically. Both cases are possible, and we don't know which case occurs for each specific situation - When searching some record with index, it starts from
root DB page
(= B+ tree root node) and find nextchild DB page
and loading it from secondary storage, then move to the child page and going again with same step until finding target key in aleaf DB page
which has pointer todata DB page
- If find, then finally read the
data DB page
from secondary storage and extract target data from the page and return it
Is my understanding correct?