One way or two way? Different opinions!
There are two kinds of two-way search on the Internet. So which one is right? We’re going to decrypt it today
talk is cheap,show me the code
The concept of page
The InnoDB of MySQL uses pages as the storage unit. Each leaf node of B + tree is a multiple of the size of a page. The default size of a page is 16K
The page structure is shown in the figure below
In other words, each page contains two page pointers, one is the previous page pointer, which points to the previous page, and the other is the next page pointer, which points to the next page.
The header also contains the type information of the page and the number used to uniquely identify the page. According to this pointer distribution, you can imagine that pages linked together are a two-way linked list.
As shown in the figure below
Since a leaf node of a B + tree is composed of a page or an integer multiple of a page, there is a bidirectional linked list structure between each leaf node.