Why is mysql to choose B + Tree

Why does Mysql choose B+TreeAlgorithm comparison

Binary tree

Why does Mysql choose B+Tree
When I look for 8 Five steps are needed

Why Mysql choose B+Tree
Red and black Tree

Mysql why choose B+Tree
When I query 8 It takes four times when there are some optimizations relative to the binary tree without infinite extension. The depth of the red-black tree will be very deep (the depth is not controllable)

Mysql Why choose B+Tree
hash

If the amount of data is large

Mysql Why choose B+Tree
Quick query (cannot find range)

BTree

Why does Mysql choose B+Tree
The query can be found only by checking two steps, the shortcomings are carried (data) Expand the horizontal and reduce the vertical depth

ps: java fetches data generally like this: java program–>CPU—>memory—->hard disk, and the interaction between memory and hard disk There is a size limit, it is a page of data 4 It is about k, so it is not possible to get all the data in one node. Generally speaking, the node will try to pre-store 4K capacity.
Why does Mysql choose B+Tree
B+Tree

Why should Mysql choose B+Tree
Why should Mysql choose B+Tree

ps:data is not placed in non-leaf nodes to increase the degree (small nodes). Generally, there will be more than one hundred so that the depth is 3~5, thereby reducing the number of queries. In addition, there will be pointers between the leaf nodes, and the data will be incremented. This allows us to search through the range of pointers, instead of searching from the top nodes one by one. It not only reduces the number of queries, but also provides range queries.

Leave a Comment

Your email address will not be published.