Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
B
树的实现
|
71
格本身保持不变。在这样做之后,对应的单元格不再是
可寻址的
,它的内容将不再出现
在查询结果中,也不需要将其置为 null 或移动相邻单元格。
当页被分裂时,只对偏移量进行调整。由于页的其余部分不可寻址,所以偏移量被截断
的单元格不再可访问,因此每当新数据到达时,它们将被覆盖,或者在清扫进程中被垃
圾收集。
有些数据库依赖于垃圾收集,并将已删除和更新的单元格留在原位,以便进行
多版本并发控制(参见 5.3.6 节)。在更新完成之前,单元格对于并发执行的事
务保持可访问性,一旦没有其他线程访问它们,就可以立即回收单元格。一些
数据库维护跟踪
幽灵记录
(ghost record)的数据结构,一旦所有可能已经看到
它们的事务完成,这些幽灵记录就会被回收 [WEIKUM01]。
由于删除操作仅丢弃单元格偏移量,而非搬运剩余单元格或物理地移除目标单元格以释
放占用的空间,所以释放的字节可能最终分散在整个页上。在这种情况下,我们说页是
碎片化的
(fragmented),需要进行碎片整理。
要进行写操作,我们通常需要可以放入单元格的一块连续的空闲区域。要将空闲碎片重
新组合在一起来满足写入的需要,我们必须
重写
页面。
插入操作保留元组的插入顺序。这对空间碎片并没有显著的影响,但是如果将元组按顺
序排列,则将有助于在顺序读取时进行高速缓存预取。
更新操作主要适用于叶子层:内部页的键多用于引导导航,其仅定义了子树的边界。
此外,更新是在每个键的基础上执行的,除非创建溢出页,否则这通常不会导致树中
的结构更改。然而,在叶子层上 ...
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