Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
简介与概述
|
19
因为诸如磁盘之类的持久性介质上的数据通常是按块访问的(换句话说,磁盘访问的最
小单位是块),所以单个块可能将包含某行中所有列的数据。这对于我们希望访问整个用
户记录的情况非常有用,但这样的存储布局会使访问多个用户记录某个字段的查询(例
如,只获取电话号码的查询)开销更大,因为其他字段的数据在这个过程中也会被读入。
1.3.2
面向列的数据布局
面向列的数据库垂直地
将数据进行分区(即通过列进行分区),而不是将其按行存储。在
这种数据存储布局中,同一列的值被连续地存储在磁盘上(而不是像前面的示例那样将
行连续地存储)。例如,如果我们要存储股票市场的历史价格,那么股票价格这一列的
数据便会被存储在一起。将不同列的值存储在不同的文件或文件段中,可以按列进行有
效的查询,因为它们可以一次性地被读取出来,而不是先对整行进行读取后再丢弃掉不
需要的列。
面向列的存储非常适合计算聚合的分析型工作负载,例如查找趋势、计算平均值等。如
果逻辑记录具有多个字段,但是其中某些字段(在本例中为股票价格)具有不同的重要
性并且该字段所存储的数据经常被一起使用,那么我们一般使用复杂聚合来处理这样的
情况。
从逻辑角度看,表示股票市场价格的数据仍旧可以表示为表的形式:
| ID | Symbol | Date | Price |
| 1 | DOW | 08 Aug 2018 | 24,314.65 |
| 2 | DOW | 09 Aug 2018 | 24,136.16 |
| 3 | S&P | 08 Aug 2018 ...
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