当前位置:网站首页>Gbase 8s index b+ tree
Gbase 8s index b+ tree
2022-06-25 04:33:00 【Eight delicacies tofu】
Database commonly used Index structure Yes Binary search tree 、B Trees ,B+ Trees 、Hash、 Bitmap and R Trees , One of the most widely used is B+ Trees . This section focuses on description B+ Tree index structure . B+ Trees can be seen as improved B Trees , Introducing B+ Before the tree , Let's take a look first B Index structure of tree , As shown in the figure .B The tree organizes the storage blocks into a tree , The tree is always in balance , That is, all leaf nodes always have the same depth .B There are three kinds of nodes in the tree : The root node 、 Branch nodes and leaf nodes . The root node points to multiple branch nodes , Branch nodes point to leaf nodes , The leaf node points to the actual data row address .

A tree m rank B A tree is a balanced one m Path search tree , Each storage block ( node ) Storage m Two keywords and m+1 A pointer to the . It's either an empty tree , Or a tree that satisfies the following properties .
- The root node contains at least two child nodes , That is, at least two pointers are used , Each pointer points to B The next level of the tree stores blocks .
- Always keep the data in order , The keywords in each storage block are arranged in ascending order .
- The branch node must have at least (m +1)/2 Two pointers are used . Suppose that... Is used in a block j Key words , Set to K1,K2,…,Kj(K1<K2<…<Kj), Then this block has j +1 Two pointers are used , Each pointer points to B The next node in the tree . The first pointer points to the keyword less than K1 The recording part of , The second pointer points to a keyword greater than or equal to K1 And less than K2 The recording part of , And so on , The first j Pointers to keywords greater than or equal to Kj-1 And less than Kj The recording part of , The last pointer points to a keyword greater than or equal to Kj The recording part of .
- In a leaf node, the last pointer points to the next leaf node to its right , That is, the next key is larger than its storage block . other m Pointers must have at least (m +1)/2 Used , Each pointer points to the actual data record . If the first j Two pointers are used , Then it points to the first in the block j Records of keywords .
therefore , These nodes can be incompletely populated , The filling degree of each node ( That is, the number of keywords ) Must be greater than a minimum percentage value , The rest of the unfilled space is wasted .

B This storage structure of the tree guarantees the search 、 The time complexity of insert and delete operations is in the logarithmic order . Recursively find from root to leaf nodes when searching , Will need to find the keyword and root node ( Branch nodes ) The keywords in are compared ( You can use sequential search or binary search ), Find the interval where the keyword exists , Recursively find the next node according to the pointer , Until the leaf node , You can find the actual data row address pointed to by the leaf node . Insertion time ,B The tree grows from the bottom , When a node overflows ( There are more keywords than m individual ) when , Nodes are automatically split , The new node will be promoted to a higher level , When deleting, the operation is just the opposite .
In order to further understand B Tree structure , The following is an example of a node split caused by inserting data , Pictured 8.5 Shown . It is assumed that each node can only store 4 Key words (m = 4), Then when one is full 4 When a record is added to a node with keywords , The nodes will split , And promote the keywords in the middle to the upper level . Keyword promotion may cause the upper level nodes to continue to split , If the root node is full 4 Key words , Then the root node will split , A new root node will be created when the tree height is increased by one layer . After the split , There will be free locations in the nodes , You can use... When adding a new record .
stay GBase 8s In the database ,B+ The index structure of the tree is shown in Figure 8.7 Shown , Each inode is bi-directional , Both have pointers to the previous and next sibling nodes , In this way, you can query the range , Positive and negative searches can also be performed among peers , The performance of index in data search is greatly improved . The ability of a node to jump left or right to its sibling node is B+ A bright spot in the tree ,GBase 8s All non multidimensional data indexes in the database are B+ Tree index .
边栏推荐
- Easyrecovery15 very easy to use computer data recovery software
- Openmmlab environment configuration
- Win10 environment phpstudy2016 startup failure record
- CTF_ Web: how to recognize and evaluate a regular expression
- A-table mouse over the display hand, the current line can be clicked
- CTF_ Web: deserialization learning notes (I) classes and objects in PHP
- Lecture record: data processing methods and applications of various spatial geodetic techniques
- Should I use on or where for the left join
- 【LeetCode】143. Rearrange linked list
- Laravel document sorting 9. Blade template
猜你喜欢

CTF_ Web:php weak type bypass and MD5 collision

Record small knowledge points

Anaconda安装+TensorFlow安装+Keras安装+numpy安装(包含镜像和版本信息兼容问题)

CTF_ Web: Learn flask template injection (SSTI) from 0

mongodb集群

论文笔记: 多标签学习 ESMC (没看懂, 还没写出来, 暂时放这里占个位置)

讲座记录《捷联惯导解算的历史及发展》

CTF_ Web: deserialization of learning notes (II) CTF classic test questions from shallow to deep

单元测试覆盖率

Finereport displays and hides column data according to conditions
随机推荐
使用文本分析识别一段文本中的主要性别
JS arrow function
GBASE 8s的级联删除功能
js的call()和apply()
CTF_ Variable coverage in web:php
无法安装redis接口
关于TCP连接四次握手(或者叫四次挥手)的详细总结
Basic use of OBS browser+ browser
CTF_ Web: Advanced questions of attack and defense world expert zone WP (15-18)
Openmmlab environment configuration
GBASE 8s中DELIMIDENT环境变量的使用
Summary of various problems encountered by cocos2d-x
ThinkPHP is integrated with esaywechat. What's wrong with wechat payment callback without callback?
MySQL order by
IntStream API介绍
马斯克发布人形机器人,AI对马斯克为什么意义重大?
CTF_ Web: Advanced questions of attack and defense world expert zone WP (9-14)
LeetCode 劍指Offer II 091 粉刷房子[動態規劃] HERODING的LeetCode之路
GbASE 8s中的Blob 页(Blobspace page)
CTF_ Web: how to recognize and evaluate a regular expression