15445 lecture#4 Database Storage 2

这篇博客探讨了数据库存储的主题,包括数据表示方法,如整数、变长数据和日期时间的存储,以及系统目录。此外,还讨论了数据库的工作负载类型,如OLTP和OLAP,以及两种存储模型——N-元存储模型(NSM)和分解存储模型(DSM)。NSM适合OLTP,数据按行存储,而DSM(列存储)适合OLAP,便于查询特定属性集。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 Data Representation

A data representation scheme is how a DBMS stores the bytes for a value. There are five high level datatypes that can be stored in tuples: integers, variable-precision numbers, fixedpoint precision numbers, variable length values, and dates/times.

DBMS对于某个类型的值,存成什么样的字节(就是编码的意思吧)

Integers

Most DBMSs store integers using their “native” C/C++ types as specified by the IEEE-754 standard. These values are fixed length. Examples: INTEGER, BIGINT, SMALLINT, TINYINT.

↑上面notes错了啊,754是浮点数。应该只有黑体是对的

Variable-Length Data

有一个header,保存string的长度,以便快速调到下一个值。也包含一个checksum

Most DBMSs do not allow a tuple to exceed the size of a single page. The ones that do store the data on a special “overflow” page and have the tuple contain a reference to that page. These overflow pages can contain pointers to additional overflow pages until all the data can be stored.

这里提到了一个overflow page,注意和书里看到的overflow block不一样,那个是指找不到freespace之后放置新record的地方,这里指的是存放大文件的page

overflow page在存放数据之前,可以存放指向其他overflow page的指针(??)

Some systems will let you store these large values in an external file, and then the tuple will contain a pointer to that file. For example, if the database is storing photo information, the DBMS can store the photos in the external files rather than having them take up large amounts of space in the DBMS. One downside of this is that the DBMS cannot manipulate the contents of this file. Thus, there are no durability or transaction protections.

这里和书里写的 一样,将large obj作为外部文件保存

Examples: VARCHAR, VARBINARY, TEXT, BLOB

Dates and Times

一般是保存为某个时间(unix epoch)之后的单位时间数

Examples: TIME, DATE, TIMESTAMP.

System Catalogs

DBMS为了理解tuple的内容,维护了一个internal catalog,记录DB的元数据,包含的信息:该DB里有什么表,哪些column,以及类型和ordering of value(??

大多数DBMS将他们的catalog保存在内部,使用的格式和他们用于存储表的格式相同(??),使用特殊的代码来bootstrap他们的catalog table

这里说的类似mysql里的information_schema?

2 Workloads

DBMS可能碰到的workload有许多种,主要分为:Online Transaction Processing和Online Analytical Processing

OLTP

特点是:fast,short running operation,简单的query,一次只查单个relation,很多重复的操作

一般是写多于读

An example of an OLTP workload is the Amazon storefront. Users can add things to their cart, they can make purchases, but the actions only affect their account.

OLAP

特点:long running,complex query,读很多的内容。通常是对OLTP产生的数据进行分析产生新数据

An example of an OLAP workload would be Amazon computing the five most bought items over a one month period for these geographical locations.

HTAP: Hybrid Transaction + Analytical Processing

3 Storage Models

在page中存储tuple的方式有很多种,到目前位置一直都是假设的n-ary storage model

N-Ary Storage Model (NSM)

这种方式下,DBMS将一个tuple的所有attr连续的放在一个page里,也被称为row store(行存储),这种适合于OLTP(存的多的,并且操作主要集中在一个entity。entity这里是指relation?)这种之所以理想是因为一次就能拿到一个tuple的全部attr

优点

快速插入,更新,删除;对于需要一整个tuple(比如select *)的很方便

缺点

如果需要扫描表的大部分,或者只需要attr的一个子集,则不太友好

因为buffer pool会取到不需要的数据(需要的不需要的混在一个block/page)

Decomposition Storage Model (DSM)

这种就是column store,将一个表中某个attr的所有值存在一起,这种适合于OLAP,因为查询操作更多,或者只需要attrs的一个子集

优点

查询时减少了无效工作,只读自己需要的attr

更方便压缩,因为同类型(同attr)的都存在一起了(怎么压缩?

缺点

插入,更新,删除慢,点查询(应该就是指查某个tuple的全部属性?)因为一个tuple没有整个存在一起,可能这个attr在这,那个attr在那

当使用column store时,为了将一个tuple再拼起来,有两种常用方法:

The most commonly used approach is fixed-length offsets. Assuming the attributes are all fixed-length, the DBMS can compute the offset of the attribute for each tuple. Then when the system wants the attribute for a specific tuple, it knows how to jump to that spot in the file from the offest. To accommodate the variable-length fields, the system can either pad fields so that they are all the same length or use a dictionary that takes a fixed-size integer and maps the integer to the value

这里是指attr的长度固定,那么DBMS就能算出属于某个tuple的某个attr的offset(这需要知道在第几个吧?

对于变长的attr,一种办法是对齐,以便让他们长度相等,或者使用dictionary,???没懂

A less common approach is to use embedded tuple ids. Here, for every attribute in the columns, the DBMS stores a tuple id (ex: a primary key) with it. The system then would also store a mapping to tell it how to jump to every attribute that has that id. Note that this method has a large storage overhead because it needs to store a tuple id for every attribute entry

一个不那么常用的方法:为每个attr维护一个所属tuple的id,另外DBMS再维护一个mapping,使得其能直接到有该id的attr

但这种做法开销很大,因为需要为每个attr值保存一个tuple id

 

 

内容概要:本文全面介绍了数据流图(DFD)的概念、构成元素及其重要性。数据流图是从数据传递和加工的角度,以图形方式表达系统逻辑功能、数据流向和变换过程的工具。文章详细解释了数据流图的四个基本元素:数据流、加工、数据存储和外部实体,并通过实例说明了这些元素在实际场景中的应用。文中强调了数据流图在软件开发需求分析和业务流程优化中的关键作用,通过绘制顶层、中层和底层数据流图,逐步细化系统功能,确保数据流向和处理逻辑的清晰性。此外,文章还指出了常见绘制误区及解决方法,并以在线购物系统为例进行了实战分析,展示了从需求分析到数据流图绘制的全过程。 适合人群:软件工程师、业务分析师、系统设计师以及对系统分析与设计感兴趣的初学者。 使用场景及目标:①帮助开发团队在需求分析阶段清晰展示数据流动和处理过程,避免理解偏差;②辅助企业梳理和优化业务流程,识别效率低下的环节,提升运营效率;③为系统设计和开发提供详细的逻辑框架,确保各模块的功能明确,减少开发错误。 阅读建议:本文内容详实,涵盖了从理论到实践的各个方面。建议读者在学习过程中结合实际项目背景,逐步掌握数据流图的绘制技巧,并通过反复练习和优化,加深对系统分析与设计的理解。
资源下载链接为: https://pan.quark.cn/s/5c50e6120579 《CoffeeTime_0.99.rar:主板BIOS修改工具详述》 在计算机硬件领域,BIOS(基本输入输出系统)是计算机启动时最先加载的软件,它负责初始化硬件设备,并为操作系统提供基本的交互功能。不过,随着处理器技术的持续进步,部分主板可能无法原生支持更新的CPU型号。为解决这一问题,一些技术爱好者和专业人士会通过修改主板BIOS,也就是俗称的“魔改”,来提升其兼容性。本文将深入剖析名为“CoffeeTime_0.99.rar”的工具,它是一款专门用于主板BIOS修改,以实现对第6、7、8、9代英特尔CPU支持的工具。 我们先来看“CoffeeTime.exe”,这是该工具的主程序文件。通常情况下,它会配备一套直观易用的用户界面,方便用户对BIOS进行修改操作。不过,在使用该工具之前,用户必须具备一定的电脑硬件知识,因为一旦操作失误,就可能导致系统运行不稳定,甚至无法启动。对于初学者而言,谨慎操作至关重要,否则可能会造成不可挽回的损失。 “readme.txt”是软件包中常见的文档,一般会包含使用指南、注意事项以及开发者提供的其他重要信息。在使用CoffeeTime之前,用户务必要仔细阅读该文件,因为里面可能包含了如何正确运行程序、避免错误操作以及解压后具体步骤等关键内容。 “bin”和“data”是两个文件夹,它们可能包含了用于BIOS修改的各种二进制文件和数据。“bin”文件夹通常会包含特定版本的BIOS固件或用于修改的工具,而“data”文件夹则可能包含更新CPU微码、识别信息等必要的数据文件。在进行BIOS修改的过程中,这些文件会被程序调用,从而实现对原有BIOS的扩展或修正。 BIOS的修改过程一般包含以下步骤:首先,备份原始BIOS,这是在进行任何修改前的必要步骤,以便
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值