【正文】
hes ? disk failure can destroy data, but is very rare 169。Silberschatz, Korth and Sudarshan Database System Concepts 5th Edition, Oct 23, 2022. BufferReplacement Policies ? Most operating systems replace the block least recently used (LRU strategy) ? Idea behind LRU – use past pattern of block references as a predictor of future references ? Queries have welldefined access patterns (such as sequential scans), and a database system can use the information in a user’s query to predict future references ? LRU can be a bad strategy for certain access patterns involving repeated scans of data ? For example: when puting the join of 2 relations r and s by a nested loops for each tuple tr of r do for each tuple ts of s do if the tuples tr and ts match … ? Mixed strategy with hints on replacement strategy provided by the query optimizer is preferable 169。Silberschatz, Korth and Sudarshan Database System Concepts 5th Edition, Oct 23, 2022. ? 記錄在頁面內(nèi)移動,頭文件中信息相應(yīng)修改( 可多次寫的光盤 是采用 另寫目錄 ) ? 外界的指針應(yīng)該指向 文件頭中的固定位置 ? 而不應(yīng)該指向具體的(可能會變的)記錄位置 169。Silberschatz, Korth and Sudarshan Database System Concepts 5th Edition, Oct 23, 2022. Chapter 11: Storage and File Structure 小結(jié) ? Overview of Physical Storage Media 物理存儲介質(zhì) ? Magic Disks 磁盤 ? RAID 磁盤陣列 ? Tertiary Storage 第三存儲 ? Storage Access 存取 ? File Organization 文件結(jié)構(gòu) ? Organization of Records in Files 記錄結(jié)構(gòu) ? DataDictionary Storage 數(shù)據(jù)字典 。Silberschatz, Korth and Sudarshan Database System Concepts 5th Edition, Oct 23, 2022. Organization of Records in Files 記錄組織 :堆,順序,散列 ,聚簇 ? Heap – a 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, 有序 ? Hashing – 影院分單雙號 Hash(X)= X mod 2,入座時搜索空間減半 ? 寶光寺:數(shù)羅漢 . ? Hash(Person, sex)=2*(RedomSeed+Age+1)+Sex ? clustering file anization 不同型記錄可放一文件內(nèi),把相關(guān)記錄(父子兄弟等,經(jīng)常同時檢索的)放在同一個磁盤塊, 減少磁盤 IO,快 ? 注意 內(nèi)存比磁盤快 10—100倍, 減少讀塊 次數(shù) 是速度關(guān)鍵 169。Silberschatz, Korth and Sudarshan Database System Concepts 5th Edition, Oct 23, 2022. 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。Silberschatz, Korth and Sudarshan Database System Concepts 5th Edition, Oct 23, 2022. Ph