Transactional Storage Manager
存储管理器(storage manager) 负责管理数据库文件,它将一组 页 组织为文件,有的 数据库管理系统 使用文件层次结构,有的使用单一文件(比如 SQLite)。
文件存储
- Heap File Organizatin
- Tree File Organization
- Sequential/Sorted File Organization (ISAM)
- Hashing File Organization
Heap File
heap file 是一组无序 元组 的集合,它将元组以任意顺序存储到文件中。
- 支持
- Create page
- Get page
- Write page
- Delete page
- 支持遍历所有页
对于单文件 heap file,可以直接通过 页 id 拿到偏移量,访问对应 页。
对于多文件 heap file,系统维护特殊的目录 页 记录其他数据 页 所在路径。需要保证目录 页 的目录信息和数据 页 同步。同时,目录 页 还记录其他可用空间的元信息:
In its most basic form, a DBMS stores a database as files on disk. Some may use a file hierarchy, others may use a single file (e.g., SQLite).[2]
The DBMS’s storage manager is responsible for managing a database’s files. It represents the files as a collection of pages. It also keeps track of what data has been read and written to pages as well how much free space there is in these pages.[2:1]
There are a couple of ways to find the location of the page a DBMS wants on the disk, and heap file organization is one of those ways. A heap file is an unordered collection of pages where tuples are stored in random order.[2:2]