B树和B +树之间有什么区别? [英] What are the differences between B trees and B+ trees?
本文介绍了B树和B +树之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 b树中,您可以将键和数据存储在内部节点和叶节点中,但是在 b +树中,仅将数据存储在叶节点中。
In a b-tree you can store both keys and data in the internal and leaf nodes, but in a b+ tree you have to store the data in the leaf nodes only.
在b +树中执行上述操作是否有优势?
Is there any advantage of doing the above in a b+ tree?
为什么不在所有地方都用b-树代替b +树,因为从直观上看它们要快得多?
Why not use b-trees instead of b+ trees everywhere, as intuitively they seem much faster?
我的意思是,为什么要在b +树中复制密钥(数据)
I mean, why do you need to replicate the key (data) in a b+ tree?
推荐答案
下图有助于显示B +树和B树之间的差异。
The image below helps show the differences between B+ trees and B trees.
B +树的优势:
- 由于B +树没有与内部节点关联的数据,因此可以容纳更多的键一页的内存。因此,访问访问叶节点上的数据将需要较少的高速缓存未命中。
- B +树的叶节点已链接,因此需要对树中的所有对象进行全面扫描树只需要线性穿过所有叶节点即可。另一方面,B树需要遍历树中的每个级别。这种全树遍历可能比B +叶的线性遍历涉及更多的缓存丢失。
B树的优点:
- 因为B树包含每个键的数据,所以频繁访问的节点可以位于根附近,因此可以更快地访问。
这篇关于B树和B +树之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文