Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
简介与概述
|
25
成本,但在读取路径上成本更高。
如果工作负载主要由读操作组成,那么更新几个索引可能没有什么问题,但是对于具有
多个索引、以写为主的工作负载,这种方法便不能很好地工作了。为了减少指针更新
的成本,一些数据库的具体实现是使用主键进行间接操作,而不是直接使用数据偏移
量。例如,MySQL InnoDB 使用主索引并执行两次查找:一次在二级索引中,一次在主
索引中 [TARIQ11]。这样并不直接使用二级索引查询得到的偏移量,因此增加了一次主索
引的查询开销。
图 1-6 展示了这两种方法的不同之处。
•
a)两个索引从二级索引文件直接指向数据条目。
•
b)二级索引通过主索引间接地定位数据条目。
主索引
数据
二级索引
二级索引
主索引
数据
a) b)
图
1-6
:直接引用数据元组(
a
)与使用主索引作为间接引用(
b
)
我们还可以使用混合方法将数据文件偏移量和主键存储在一起。首先,你要检查数据偏
移量是否仍然有效,如果它已经发生变化了,则需要额外对主键索引进行遍历,在找到
新的偏移量后更新索引文件。
1.5
缓冲、不可变性和有序性
存储引擎基于某些数据结构。但是,这些结构并不描述缓存、恢复、事务性以及存储引
擎在它们之上添加的其他内容的语义。
在接下来的章节中,我们将从 B 树开始讨论(参见 2.3 节),并试图解释为什么有这么多
的 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