DataBase System 沙课后阅读 3.1,32 4.14.2 Haichang Gao, Software School, Xidian University 18
DataBase System Haichang Gao , Software School , Xidian University 18 课后阅读 3.1, 3.2 4.1, 4.2
DataBase System 罗 DAtabase file(ch11) The database is stored as a collection of files. Each file is a sequence of records e a data base file is partitioned into fixed-length storage units called blocks. blocks are units of both storage allocation and data transfer G Database system seeks to minimize the number of block transfers between the disk and memory. we can reduce the number of disk accesses by keeping as many blocks as possible in main memory. c Buffer portion of main memory available to store copies of disk blocks Haichang Gao, Software School, Xidian University 19
DataBase System Haichang Gao , Software School , Xidian University 19 Database File (ch11) The database is stored as a collection of files. Each file is a sequence of records A database file is partitioned into fixed-length storage units called blocks. Blocks are units of both storage allocation and data transfer. Database system seeks to minimize the number of block transfers between the disk and memory. We can reduce the number of disk accesses by keeping as many blocks as possible in main memory. Buffer – portion of main memory available to store copies of disk blocks
DataBase System Database file Block header Records Size Entrie Location Free Space ====== End of Free space a block is composed by block header, records and free space a page header contains t number of record entries E end of free space in the block a location and size of each record G Records can be moved around within a page to keep them contiguous with no empty space between them P Blocks are linked together as a file Haichang Gao, Software School, Xidian University 20
DataBase System Haichang Gao , Software School , Xidian University 20 Database File A block is composed by block header, records and free space A 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 Blocks are linked together as a file
DataBase System 6 Index of Table(ch12) e Records may be stored in the Sequential File organization (n 序文件) ordered by a search-kegy H Example: the account relation storage ordered by branch name. A-217 Brighton750 P To find the records A-101 Downtown 500 A-110 Downtown 600 a By a given branch name A-215 Mianus 700 value A-102 Perrvridge 400 A-201 Perrvridge 900 binary search(二分查找) A-218 Perryridge 700 H By a given balance value? A-222 Redwood700 A-305 Round Hill 350 Linear search(线性查找) NOT a good idea Haichang Gao, Software School, Xidian University 21
DataBase System Haichang Gao , Software School , Xidian University 21 Index of Table (ch12) Records may be stored in the Sequential File Organization(顺 序文件) ordered by a search-key. Example: the account relation storage ordered by branch_name: To find the records By a given branch_name value? -- binary search(二分查找) By a given balance value? --Linear search(线性查找) NOT a good idea!
DataBase System Index of table A-217Brighton 750 A-101 Downtown 500 400 A-110 Downtown600 500 A-215 Mianus 700 600 A-102 Perryridge 40 700 A-201 Pe idg 900 750 A-218 Perryridge 700 900 A-222 Redwood 700 A-305 Round Hill 350 An index file consists of records(called index entries )of the form: search-keyI pointer H Search Key -attribute or set of attributes used to look up records in a file Search Key is ordered or hashed H Indexing mechanisms used to speed up access to desired data Haichang Gao, Software School, Xidian University 22
DataBase System Haichang Gao , Software School , Xidian University 22 Index of Table An index file consists of records (called index entries) of the form: search-key pointer Search Key - attribute or set of attributes used to look up records in a file. Search Key is ordered or hashed. Indexing mechanisms used to speed up access to desired data