《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 13 Data Storage Structures

File Organization The database is stored as a collection of files.Each file is a sequence of records.A record is a sequence of fields. One approach Assume record size is fixed Each file has records of one particular type only Different files are used for different relations This case is easiest to implement;will consider variable length records later We assume that records are smaller than a disk block Database System Concepts-7th Edition 13.2 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 13.2 ©Silberschatz, Korth and Sudarshan th Edition File Organization ▪ The database is stored as a collection of files. Each file is a sequence of records. A record is a sequence of fields. ▪ One approach • Assume record size is fixed • Each file has records of one particular type only • Different files are used for different relations This case is easiest to implement; will consider variable length records later ▪ We assume that records are smaller than a disk block

Fixed-Length Records Simple approach: Store record i starting from byte n *(i-1),where n is the size of each record. Record access is simple but records may cross blocks Modification:do not allow records to cross block boundaries record 0 10101 Srinivasan Comp.Sci. 65000 record 1 12121 Wu Finance 90000 record 2 15151 Mozart Music 40000 record 3 22222 Einstein Physics 95000 record 4 32343 El Said History 60000 record 5 33456 Gold Physics 87000 record 6 45565 Katz Comp.Sci. 75000 record 7 58583 Califieri History 62000 record 8 76543 Singh Finance 80000 record 9 76766 Crick Biology 72000 record 10 83821 Brandt Comp.Sci. 92000 record 11 98345 Kim Elec.Eng. 80000 Database System Concepts-7th Edition 13.3 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 13.3 ©Silberschatz, Korth and Sudarshan th Edition Fixed-Length Records ▪ Simple approach: • Store record i starting from byte n (i – 1), where n is the size of each record. • Record access is simple but records may cross blocks ▪ Modification: do not allow records to cross block boundaries

Fixed-Length Records Deletion of record i:alternatives: move recordsi+1,...,n to i,...,n-1 move recordn to i do not move records.but link all free records on a free list Record 3 deleted record 0 10101 Srinivasan Comp.Sci. 65000 record 1 12121 Wu Finance 90000 record 2 15151 Mozart Music 40000 record 4 32343 El Said History 60000 record 5 33456 Gold Physics 87000 record 6 45565 Katz Comp.Sci. 75000 record 7 58583 Califieri History 62000 record 8 76543 Singh Finance 80000 record 9 76766 Crick Biology 72000 record 10 83821 Brandt Comp.Sci. 92000 record 11 98345 Kim Elec.Eng. 80000 Database System Concepts-7th Edition 13.4 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 13.4 ©Silberschatz, Korth and Sudarshan th Edition Fixed-Length Records ▪ Deletion of record i: alternatives: • move records i + 1, . . ., n to i, . . . , n – 1 • move record n to i • do not move records, but link all free records on a free list Record 3 deleted

Fixed-Length Records Deletion of record i:alternatives: move records i+1,...,n to i,...,n-1 move record n to i do not move records,but link all free records on a free list Record 3 deleted and replaced by record 11 record 0 10101 Srinivasan Comp.Sci. 65000 record 1 12121 Wu Finance 90000 record 2 15151 Mozart Music 40000 record 11 98345 Kim Elec.Eng. 80000 record 4 32343 El Said History 60000 record 5 33456 Gold Physics 87000 record 6 45565 Katz Comp.Sci. 75000 record 7 58583 Califieri History 62000 record 8 76543 Singh Finance 80000 record 9 76766 Crick Biology 72000 record 10 83821 Brandt Comp.Sci. 92000 Database System Concepts-7th Edition 13.5 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 13.5 ©Silberschatz, Korth and Sudarshan th Edition Fixed-Length Records ▪ Deletion of record i: alternatives: • move records i + 1, . . ., n to i, . . . , n – 1 • move record n to i • do not move records, but link all free records on a free list Record 3 deleted and replaced by record 11

Fixed-Length Records Deletion of record i:alternatives: move records i+1,...,n to i,...,n-1 move recordn to i do not move records,but link all free records on a free list header record 0 10101 Srinivasan Comp.Sci. 65000 record 1 record 2 15151 Mozart Music 40000 record 3 22222 Einstein Physics 95000 record 4 record 5 33456 Gold Physics 87000 record 6 record 7 58583 Califieri History 62000 record 8 76543 Singh Finance 80000 record 9 76766 Crick Biology 72000 record 10 83821 Brandt Comp.Sci. 92000 record 11 98345 Kim Elec.Eng. 80000 Database System Concepts-7th Edition 13.6 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 13.6 ©Silberschatz, Korth and Sudarshan th Edition Fixed-Length Records ▪ Deletion of record i: alternatives: • move records i + 1, . . ., n to i, . . . , n – 1 • move record n to i • do not move records, but link all free records on a free list

Variable-Length Records Variable-length records arise in database systems in several ways: Storage of multiple record types in a file. Record types that allow variable lengths for one or more fields such as strings(varchar) Record types that allow repeating fields (used in some older data models). Attributes are stored in order Variable length attributes represented by fixed size (offset,length),with actual data stored after all fixed length attributes Null values represented by null-value bitmap Null bitmap (stored in 1 byte) 0000 21,5 26,10 36,10 65000 10101 Srinivasan Comp.Sci. Bytes 0 4 8 12 2021 26 36 45 Database System Concepts-7th Edition 13.7 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 13.7 ©Silberschatz, Korth and Sudarshan th Edition Variable-Length Records ▪ Variable-length records arise in database systems in several ways: • Storage of multiple record types in a file. • Record types that allow variable lengths for one or more fields such as strings (varchar) • Record types that allow repeating fields (used in some older data models). ▪ Attributes are stored in order ▪ Variable length attributes represented by fixed size (offset, length), with actual data stored after all fixed length attributes ▪ Null values represented by null-value bitmap

Variable-Length Records:Slotted Page Structure Block Header Records Size Entries Free Space Location End of Free Space Slotted page header contains: number of record entries end of free space in the block location and size of each record ■ Records can be moved around within a page to keep them contiguous with no empty space between them;entry in the header must be updated. Pointers should not point directly to record-instead they should point to the entry for the record in header. Database System Concepts-7th Edition 13.8 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 13.8 ©Silberschatz, Korth and Sudarshan th Edition Variable-Length Records: Slotted Page Structure ▪ Slotted page header contains: • number of record entries • end of free space in the block • location and size of each record ▪ Records can be moved around within a page to keep them contiguous with no empty space between them; entry in the header must be updated. ▪ Pointers should not point directly to record — instead they should point to the entry for the record in header

Storing Large Objects E.g.,blob/clob types Records must be smaller than pages Alternatives: Store as files in file systems Store as files managed by database Break into pieces and store in multiple tuples in separate relation ·PostgreSQL TOAST Database System Concepts-7th Edition 13.9 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 13.9 ©Silberschatz, Korth and Sudarshan th Edition Storing Large Objects ▪ E.g., blob/clob types ▪ Records must be smaller than pages ▪ Alternatives: • Store as files in file systems • Store as files managed by database • Break into pieces and store in multiple tuples in separate relation ▪ PostgreSQL TOAST

Organization of Records in Files Heap-record can be placed anywhere in the file where there is space ■ Sequential-store records in sequential order,based on the value of the search key of each record ■ In a multitable clustering file organization records of several different relations can be stored in the same file Motivation:store related records on the same block to minimize 1/O B+-tree file organization Ordered storage even with inserts/deletes More on this in Chapter 14 Hashing-a hash function computed on search key;the result specifies in which block of the file the record should be placed More on this in Chapter 14 Database System Concepts-7th Edition 13.10 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 13.10 ©Silberschatz, Korth and Sudarshan th Edition Organization of Records in Files ▪ Heap – record can be placed anywhere in the file where there is space ▪ Sequential – store records in sequential order, based on the value of the search key of each record ▪ In a multitable clustering file organization records of several different relations can be stored in the same file • Motivation: store related records on the same block to minimize I/O ▪ B+ -tree file organization • Ordered storage even with inserts/deletes • More on this in Chapter 14 ▪ Hashing – a hash function computed on search key; the result specifies in which block of the file the record should be placed • More on this in Chapter 14

Heap File Organization Records can be placed anywhere in the file where there is free space Records usually do not move once allocated Important to be able to efficiently find free space within file ■Free-space map Array with 1 entry per block.Each entry is a few bits to a byte,and records fraction of block that is free In example below,3 bits per block,value divided by 8 indicates fraction of block that is free 4214736512011056 Can have second-level free-space map In example below,each entry stores maximum from 4 entries of first- level free-space map 4726 Free space map written to disk periodically,OK to have wrong (old)values for some entries(will be detected and fixed) Database System Concepts-7th Edition 13.11 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 13.11 ©Silberschatz, Korth and Sudarshan th Edition Heap File Organization ▪ Records can be placed anywhere in the file where there is free space ▪ Records usually do not move once allocated ▪ Important to be able to efficiently find free space within file ▪ Free-space map • Array with 1 entry per block. Each entry is a few bits to a byte, and records fraction of block that is free • In example below, 3 bits per block, value divided by 8 indicates fraction of block that is free • Can have second-level free-space map • In example below, each entry stores maximum from 4 entries of firstlevel free-space map ▪ Free space map written to disk periodically, OK to have wrong (old) values for some entries (will be detected and fixed)
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 12 Physical Storage Systems.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 11 Data Analytics.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 10 Big Data.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 01 Introduction(Avi Silberschatz Henry F. Korth S. Sudarshan).pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 9 Object-Based Databases.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 8 Application Design and Development.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 7 Relational Database Design.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 6 Entity-Relationship Model.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 5 Other Relational Languages.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 4 Advanced SQL.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 3 SQL.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter Advanced Transaction Processing.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 24 Advanced Data Types.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 23 Advanced Application Development.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 22 Distributed Databases.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 21 Parallel Databases.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 20 Database System Architectures.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 2 Relational Model.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 19 Information Retrieval.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第五版,PPT课件讲稿,英文版)Chapter 18 Data Analysis and Mining.ppt
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 14 Indexing.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 15 Query Processing.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 16 Query Optimization.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 17 Transactions.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 18 Concurrency Control.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 19 Recovery System.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 02 Intro to Relational Model.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 20 Database System Architectures.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 21 Parallel and Distributed Storage.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 22 Parallel and Distributed Query Processing.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 23 Parallel and Distributed Transaction Processing.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 24 Advanced Indexing.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 25 Advanced Application Development.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 26 Blockchain Databases.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 27 Formal-Relational Query Languages.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 28 Advanced Relational Database Design.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 29 Object-Based Databases.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 03 Introduction to SQL.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 30 XML.pptx
- 《数据库系统概念 Database System Concepts》原书教学资源(第七版,PPT课件讲稿,英文版)Chapter 31 Information Retrieval.pptx