Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
B
树基础知识
|
43
合并前 合并后
图
2-13
:叶节点的合并
合并前 合并后
图
2-14
:非叶节点的合并
总之,假设元素已经被删除,节点合并分为三步:
1. 从
右
节点复制所有元素到
左
节点。
2. 从父节点删除
右
节点指针(如果是非叶子节点合并,则将此指针进行
降级
)。
3. 删除右节点。
为了减少分裂和合并的次数,B 树经常采用的技术之一是再平衡,我们将在 4.4 节中讨
论它。
2.4
本章小结
在本章中,我们首先介绍了创建磁盘存储专用结构的动机。我们指出了二分搜索树可能
具有相似的复杂度特性,但因为其扇出低,且平衡会引起的大量数据移动与指针更新,
所以不是特别适用于磁盘。而 B 树通过增加每个节点中存储的数据项的数目(高扇出)
和减少平衡操作的频率来解决这两个问题。
44
|
第
2
章
随后,我们讨论了 B 树结构的内部原理以及其查找、插入和删除操作的算法概要。分裂
和合并操作有助于重新构造树,以便在添加和删除元素时保持树的平衡。我们将树的深
度保持在最小值,并在节点中仍有一些可用空间时向现有节点中添加数据项。
我们可以利用这些知识在内存中构造一个 B 树。为了实现一个基于磁盘的 B 树,我们需
要深入了解如何在磁盘上布局 B 树的节点,以及如何使用数据编码格式来构建磁盘上的
布局。
更多阅读
如果你想了解更多本章中提到的概念,可以参考以下资料: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

解密金融数据

解密金融数据

Justin Pauley

Publisher Resources

ISBN: 9787111655169