1 / 25

Yunsheng Liu

V. Data Storage Management. Yunsheng Liu. Software College, HUST 2007. 11. Data satisfying request. CPU. Request for data. Cache. Primary storage. EEPROM. Main Memory. Fresh Memory. Magnetic Disk. Secondary storage. CD-ROM. Optical Disk. Magnetic Tape. Tertiary storage.

jalena
Download Presentation

Yunsheng Liu

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. V Data Storage Management Yunsheng Liu Software College, HUST 2007. 11

  2. Data satisfying request CPU Request for data Cache Primary storage EEPROM Main Memory Fresh Memory Magnetic Disk Secondary storage CD-ROM Optical Disk Magnetic Tape Tertiary storage 5.1 The Memory Hierarchy 5.1.1 The Storage Levels Yunsheng Liu

  3. Spindle Disk arm Disk head Tracks Platter Cylinder Sector Gaps Block 5.1.2 Disk Property— electricalerasable Yunsheng Liu

  4. 5.1.2 Disk Property access time=seek time+rotational delay+transfer time Yunsheng Liu 2. Performance property of disks 1). Data must be in main memory for the DBMS to operate on it 2). The unit for data transfer between main memory and disk is a block. R/W a disk block is called an I/O 3). Block access time—from when an R/W is issued to when the block appears in MM:

  5. 3. Performance measures of disks • Capacity • Access latency( seek time + rotational latency time) • Data transfer rate 4. Optimization of disk-block access • File organization • Scheduling (Disk-arm, i.e. I/O) • Nonvolatile RAM for writing: Battery-backed-up RAM • Log disk—devoted to writing log in much the same way as non-V RAM. Log-based file system 5.1.2 Disk Property Yunsheng Liu

  6. Level 0: Nonredundant striping • Level 1: Mirrored disks • Level 2: Error-correcting code (ECC) 5.1.3 RAID Concept • Increase performance—data striping • Improve reliability—redundancy • RAID Levels Yunsheng Liu RAID—Redundant Arrays of Independent(historically Inexpensive) Disks A Disk array—an arrangement of several disks, organized so as to

  7. 5.2 Stored Data Management 5.2.1 Introduction 1. Stored Data Kinds:  User database  Data Dictionary/ Directory,  Log 2. Stored Data Structures:  Arrangement: sequential, random  Connection: address adjacent, chaining 3. Access modes: sequential, indexed, hashing 4. I/O Buffer management 5. Interface to OS Yunsheng Liu

  8. 5.2.2 Storage Management Structures 5.2 Stored Data Management 2. Physical structure  Stored structure: stored file stored record  stored item  Device structure: device  volume cylinder track physical record/sector • Logical structure: •  Logical file page record field 3. Allocation structure  Extent block Yunsheng Liu

  9. Allocation structure Physical structure Logical structure Stored structure Volume Logic File Stored File Extent Cylinder Track Block Page Sector Stored Record Logic Record Stored Item Field 5.2 Stored Data Management 4. Mapping From Logical Structure to Physical Structure Yunsheng Liu

  10. Heap File Sequential File Sorted File General Index File File Org. Indexed File B-Tree Tree Index File Random File B+-Tree Static Hash Hash File Dynamic Hash 5.2 Stored Data Management Yunsheng Liu 5.2.3 Overview of File Organizations 1. Stored Data Arrangement 2. Access Modes

  11. Storage structure Heap Sorted Indexed Hashed Chain Access mode Chained Sequential Adjacent Sequential processing Indexed sequential Static hash Tree- structural Random processing Dynamic hash 5.2 Stored Data Management Yunsheng Liu 3. Classification of File Organizations

  12. Frame 1 Frame N Frame 2 Frame N+m Fid P Data block 1 Data block 2 Data block N • • • File Head Free blocks 5.3 Sequential File Structure - How to organize blocks/pages in a file to support to create, destroya file, and get, insert, delete a record andscanall records in the file • Conjunctive arrangement of blocks • Problems: how to insert, delete? how many free slots/pages? Yunsheng Liu

  13. S# SName SAge Dept 200103001 李红光 23SW 200405840 何清溪 19MS 200203123 刘要武 20CS 200101015 李光 22EE 200203101 刘 民20CS 200305103 张一清21MS 200403123 张扬名18SW 200201123 王克勤21EE S# SName SAge Dept 200101015 李光 22EE 200103001 李红光 23SW 200201123 王克勤21EE 200203101 刘 民20CS 200203123 刘要武 20CS 200305103 张一清21MS 200403123 张扬名18SW 200405840 何清溪 19MS Student Student (b). Ordered Sequence Structure (a). Natural Sequence Structure 5.3 Sequential File Structure • Example Yunsheng Liu

  14. File Header …  Fid P Data page Data page Data page (a). Hybrid Chain Data block  File Header Data block Data block P1 P2 Fid … … Data block Data block (b) Separated Chain  Data block 5.4 Chained List File Structure • The space for pointers of the chains • Virtually, the full list will be empty in variable record Yunsheng Liu

  15. 5.5 Index Structures 5.5.1 Overview of Indexes 1. Concepts • An index is an auxiliary data structure that is intended to help us find Rids of records with given search key value • An index is a file/collection of records, referred as indexentries, which are usually pairs (k, Rid) and Rid is a pointer to a record with search key value k • An index is a mechanism of KTA(Key to Address) Yunsheng Liu

  16. kj Indexing on SK ki Search key SK kr ki ridi Domain of SK k       kr ridr       kj ridj Index entries Data File Index The records with the value k of SK 5.5.1 Overview of Indexes Yunsheng Liu 2. Generic index structure

  17. 5.5.1 Overview of Indexes 3. Index file organizations • How to organize index entries to support rapid retrieval of entries with a given search key value? e.g. • Sequential indexes • Various tree-structural indexes, • Hash-based indexes—Scatter Table Yunsheng Liu

  18. 5.5.2 Properties of Indexes • Dense vs. Sparse • Dense: an index entryindividual data record • Sparse: an index entrya set (usually, a block/page) • of data records Yunsheng Liu Clustered vs. Unclustered  Clustered— the ordering of data records is the same as (or close to ) the ordering of index entries - The two orderings are matched with each other  Unclusterd —not match with each other

  19. 5.5.2 Properties of Indexes Yunsheng Liu Primary vs. Secondary  Primary index  Primary key  Secondary index  Candidate/Secondary key Simple vs. Composite Key  Composite key more than one fields Simple key  single field

  20. -- … … Root Node … Kn rn Pn P0 K1 r1 P1 K2 r2 P2 • • • Pn-1 Inner Nodes R(K2) R(K1) Data Records 5.6 B-Tree Structured Indices Yunsheng Liu Nonleaf Node structure

  21.  60 10 50     70 20 - - … K1 r1 K2 r2 … Km rm  3 5  -  - 52 54 55 61 63 65 74 78  - 69 11 13 14  - 22 23  - … R(K1) R(K2) …   - R(50) R(20) R(10) R(60) R(70) 5.6 B-Tree Structured Indices Leaf Node Structure A B-tree structure Yunsheng Liu

  22. P0 K1 P1 K2 P2 • • • Pn-1 Kn Pn … K1 r1 K2 r2 … Km rm … 5.7 B+-Tree Structured Indices Nonleaf Node structure Leaf Node Structure Yunsheng Liu

  23. Random access Index Set Sequential access B+-tree  Sequence Set   Record Set  Data File 5.7 B+-Tree Structured Indices A B+-tree structure Yunsheng Liu

  24. Major Data Area Overflow Area Hash Function B0 B1 ki h(ki) Block •• • •• • Bn-1 Record slot 5.8 Hashing File Structures General Hashing Structure Yunsheng Liu

  25. Primary blocks Bu1 Key Hashing Function Bu2 • • • Buckets KTA Transformation • • • Bun • • • 5.8 Hashing File Structures Bucket Hashing Yunsheng Liu

More Related