MySQL-InnodbPage结构

2019-12-25  本文已影响0人  多血

基本结构

image.png

标准头尾

image.png

首先不管任何类型的数据页都有38个字节来描述头信息(FIL_PAGE_DATA, or PAGE_HEADER),包含如下信息:


image.png

Index Page

索引最基本的页类型为FIL_PAGE_INDEX。


image.png

Index Header

紧随FIL_PAGE_DATA之后的是索引信息,这部分信息是索引页独有的。


image.png

FSEG HEADER

随后20个字节描述段信息,仅在Btree的root Page中被设置,其他Page都是未使用的。


image.png

System Records

System records: InnoDB has two system records in each page called infimum and supremum. These records are stored in a fixed location in the page so that they can always be found directly based on byte offset in the page.


image.png

Infimum与Supremum连接着页内的所有User record。


image.png
image.png

User Records

For both leaf and non-leaf pages, each record (including the infimum and supremum system records) contain a “next record” pointer, which stores an offset (within the page) to the next record. The linked list starts at infimum and links all records in ascending order by key, terminating at supremum. The records are not physically ordered within the page (they take whatever space is available at the time of insertion); their only order comes from their position in the linked list.

Page Directory

作用:B+Tree索引本身并不能直接找到具体的一行记录,只能找到该行记录所在的页,数据库把页载入到内存中,然后通过Page Directory再进行二分查找,二分查找时间复杂度很低,又在内存中进行查找,这部分的时间基本开销可以忽略。
Page directory是逆序存放的。

image.png

https://blog.jcole.us/2013/01/03/the-basics-of-innodb-space-file-layout/
https://blog.jcole.us/2013/01/10/btree-index-structures-in-innodb/
http://zhongmingmao.me/2017/05/08/innodb-table-page-structure/
https://blog.csdn.net/yuanrxdu/article/details/42215981
https://mp.weixin.qq.com/s/8vHSKjLUbBh1vxNqlrbwDQ
https://blog.csdn.net/yuanrxdu/article/details/42215981

上一篇下一篇

猜你喜欢

热点阅读