当前位置:网站首页>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 .
边栏推荐
- 关于TCP连接四次握手(或者叫四次挥手)的详细总结
- What is persistence? What are RDB and AOF in redis persistence?
- OBS Browser+浏览器的基本使用
- GBASE 8s的多线程结构
- mysql的tinyint字段类型判断的疑惑
- Doubts about judging the tinyint field type of MySQL
- Anaconda installation +tensorflow installation +keras installation +numpy installation (including image and version information compatibility issues)
- Text keyword extraction: ansj
- CTF_ Web: advanced problem WP (5-8) of attack and defense world expert zone
- Should I use on or where for the left join
猜你喜欢

CTF_ Web: Advanced questions of attack and defense world expert zone WP (1-4)

CTF_ Web: advanced problem WP (5-8) of attack and defense world expert zone

Anaconda installation +tensorflow installation +keras installation +numpy installation (including image and version information compatibility issues)

Unit test coverage

CTF_ Web:8-bit controllable character getshell

Coinlist queuing tutorial to improve the winning rate

i. Max development board learning record

GBASE 8s 索引B+树

A detailed summary of four handshakes (or four waves) over TCP connections

CTF_ Web: Learn flask template injection (SSTI) from 0
随机推荐
Multithreading structure of gbase 8s
Flutter Builder & futurebuilder components
kenlm
【esp32学习之路6——flash加密】
马斯克发布人形机器人,AI对马斯克为什么意义重大?
95% of programmers fish here
Numpy NP tips: use OpenCV to interpolate and zoom the array to a fixed shape cv2 resize(res, dsize=(64, 64), interpolation=cv2. INTER_ CUBIC)
Read lsd-slam: large scale direct monolithic slam
2020.3.3 notes async/await and promise and Then processes and threads
Numpy NP tips: squeeze and other processing of numpy arrays
CTF_ Web: advanced problem WP (5-8) of attack and defense world expert zone
Communication problems in parent and child components of uniapp
Cascading deletion of gbase 8s
"Renaissance" in the digital age? The bottom digital collection makes people happy and sad
What is persistence? What are RDB and AOF in redis persistence?
@Requestbody solution get parameter is null
5 key indicators of SEO: ranking + traffic + session + length of stay + bounce rate
Structure syntaxique des procédures stockées gbase 8S
什么是持久化?redis 持久化中的RDB和AOF是什么?
简单的恶意样本行文分析-入门篇