mysql mysql index index principle ------ Why to choose this B + tree data structure, rather than a binary tree, red-black tree, B tree?

Why mysql index to choose this B + tree data structure, rather than a binary tree, red-black tree, B tree?
First we look at the structure of a binary tree
Here Insert Picture Description
on the pictures you can clearly see the height of the tree is 6, 6 if we want to query this element if we want to query 6 times, which apparently was not satisfied with the actual development needs.
Then the red-black tree, red-black tree is a balanced binary tree
Here Insert Picture Description
can clearly see the same elements, black tree height in storage is lower than the binary tree, red-black tree in conjunction with the share yo operation handedness to reduce tree height, thus reducing the number of times we reach the tree element queries to improve query efficiency, of course, this would meet the requirements of our database queries yet?
Let us look at the B-tree:
Here Insert Picture Description
the picture you can clearly see, compared to B-trees and red-black tree, B-tree fat, and pay would be stored on a data node, and a B-tree is a multi-tree, that a B tree node can have multiple children nodes, compared to the red-black tree further reduce the height of the tree, of course, still does not meet the needs of the index. Let us look at B + tree:
Here Insert Picture Description
the picture we can see the data B + tree will be strong () is stored in the leaf nodes, and between leaf nodes are pointers to another, which will improve the efficiency of the query range.
So B + tree is the most suitable tree structure of the query index.

Published 61 original articles · won praise 102 · views 270 000 +

Guess you like

Origin blog.csdn.net/qq_17011423/article/details/104668352