B树和B +树之间的差异 [英] Differences between B trees and B+ trees
本文介绍了B树和B +树之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 b-tree 中,您可以将键和数据存储在内部和叶节点,但在 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屋!
查看全文