Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
130
|
第
7
章
RUM
猜想
有一种流行的存储结构开销模型考虑了如下三个因素:
读取
(Read)、
更新
(Update)和
内存
(Memory)
开销
。它被称为 RUM 猜想 [ATHANASSOULIS16]。
RUM 猜想指出,减少其中两项开销将不可避免地导致第三项开销的恶化,并且优化只
能以牺牲三个参数中的一个为代价。我们可以根据这三个参数对不同的存储引擎进行比
较,以了解它们针对哪些参数进行了优化,以及其中隐含着哪些可能的权衡。
一个理想的解决方案是拥有最小的读取开销,同时保持较低的内存与写入开销。但在现
实中,这是无法实现的,因此我们需要进行取舍。
B 树是针对读进行优化的。对 B 树的写入需要在磁盘上找到一个记录,而随后对同一页
的写入可能需要多次更新该磁盘页面。还要为将来的更新和删除保留额外的空间,这会
增加空间开销。
而 LSM 树则不需要在写入期间定位磁盘上的记录,也不用为以后的写入保留额外的空
间。但由于存储冗余记录,所以仍然存在一些空间开销。在默认配置中,由于必须通过
访问多个表才能返回完整的结果,所以读取的成本更高。但是,本章中讨论的优化有助
于缓解这个问题。
正如我们在关于 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