Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the principle of btree Index

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail what is the principle of btree indexing, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

The principle of btree index is that binary tree leads to very high height, logically close nodes, physically very far away, unable to make use of locality, many times of IO, and low search efficiency; Btree is a balanced "m-way" search tree, which can use multiple branch nodes to reduce the number of nodes experienced when querying data.

Principle of BTree indexing

Binary trees lead to very high tree height, logically close nodes, physically very far away, unable to make use of locality, many times of IO, and low search efficiency.

Btree is a balanced m-way search tree, which can use multiple branch nodes (sub-tree nodes) to reduce the number of nodes experienced when querying data, so as to achieve the purpose of saving access time. M is called the degree of B-Tree.

B-tree can be seen as an extension of 2-3 search tree, that is, it allows each node to have 1 child node.

Characteristics

There is one root node, there is only one record and two children, or the root node is empty.

The key and pointer in each node record are spaced from each other, and the pointer points to the child node.

D is the width of the tree. Except for the leaf node, every other node has a record, and the key in these records are arranged according to size from left to right, and there are many children.

In a node, all the key in the nth subtree is less than the nth key in this node, and greater than the nth-1st key.

All leaf nodes must be at the same level, that is, they have the same depth

Because of the characteristics of B-Tree, the algorithm of retrieving data by key in B-Tree is very intuitive: first, the binary search is carried out from the root node, and if it is found, the data of the corresponding node is returned, otherwise, the node pointed to by the pointer of the corresponding interval is searched recursively until the node is found or the null pointer is found.

On what is the principle of btree index to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report