Download presentation
Presentation is loading. Please wait.
1
Data Storage Management
V Data Storage Management Yunsheng Liu Software College, HUST
2
5.1 The Memory Hierarchy 5.1.1 The Storage Levels
CPU Cache Main Memory Magnetic Disk Magnetic Tape Request for data Data satisfying request Tertiary storage Secondary storage Primary storage Fresh Memory Optical Disk EEPROM CD-ROM Yunsheng Liu
3
5.1.2 Disk Property— electrical erasable
Tracks Block Cylinder Platter Sector Gaps Disk head Disk arm Spindle Yunsheng Liu
4
5.1.2 Disk Property 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: access time=seek time+rotational delay+transfer time Yunsheng Liu
5
5.1.2 Disk Property 3. Performance measures of disks Capacity
Access latency( seek time + rotational latency time) Data transfer rate 3. Performance measures of disks 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 Yunsheng Liu
6
5.1.3 RAID Concept RAID—Redundant Arrays of Independent(historically
Inexpensive) Disks A Disk array—an arrangement of several disks, organized so as to Increase performance—data striping Improve reliability—redundancy RAID Levels Level 0: Nonredundant striping Level 1: Mirrored disks Level 2: Error-correcting code (ECC) Yunsheng Liu
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 5.2.2 Storage Management Structures Logical structure: Logical file page record field 2. Physical structure Stored structure: stored file stored record stored item Device structure: device volume cylinder track physical record/sector 3. Allocation structure Extent block Yunsheng Liu
9
5.2 Stored Data Management
4. Mapping From Logical Structure to Physical Structure Volume Sector Logical structure Stored structure Allocation structure Physical structure Logic File Page Logic Record Field Stored File Stored Record Stored Item Cylinder Track Block Extent Yunsheng Liu
10
5.2 Stored Data Management
5.2.3 Overview of File Organizations 1. Stored Data Arrangement 2. Access Modes File Org. Sequential File Random File Heap File Sorted File Indexed File General Index File Hash File Tree Index File B+-Tree B-Tree Static Hash Dynamic Hash Yunsheng Liu
11
5.2 Stored Data Management
3. Classification of File Organizations Adjacent Chained Sequential Indexed sequential Tree- structural Static hash Dynamic Sequential processing Random processing Storage structure Heap Sorted Hashed Access mode Chain Yunsheng Liu
12
5.3 Sequential File Structure
- How to organize blocks/pages in a file to support to create, destroy a file, and get, insert, delete a record and scan all records in the file Conjunctive arrangement of blocks File Head Free blocks Data block 1 Data block 2 Data block N Frame 1 Frame 2 Frame N Frame N+m • • • Fid P Problems: how to insert, delete? how many free slots/pages? Yunsheng Liu
13
5.3 Sequential File Structure
Example Student S# SName SAge Dept 李红光 SW 何清溪 MS 刘要武 CS 李 光 EE 刘 民 CS 张一清 MS 张扬名 SW 王克勤 EE (a). Natural Sequence Structure Student S# SName SAge Dept 李 光 EE 李红光 SW 王克勤 EE 刘 民 CS 刘要武 CS 张一清 MS 张扬名 SW 何清溪 MS (b). Ordered Sequence Structure Yunsheng Liu
14
5.4 Chained List File Structure
Data page Fid P File Header (a). Hybrid Chain … Data block (b) Separated Chain File Header P1 P2 Fid … 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 index entries, 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
5.5.1 Overview of Indexes 2. Generic index structure k Indexing on SK
Index entries Search key The records with the value k of SK ridi ki ridr kr ridj kj Index SK Data File Domain of Yunsheng Liu
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 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 Dense vs. Sparse Dense: an index entryindividual data record Sparse: an index entrya set (usually, a block/page) of data records Yunsheng Liu
19
5.5.2 Properties of Indexes 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 Yunsheng Liu
20
5.6 B-Tree Structured Indices
Nonleaf Node structure - - … Pn Pn-1 • • • Kn rn P2 K2 r2 P1 K1 r1 P0 Root Node Inner Nodes R(K1) R(K2) Data Records Yunsheng Liu
21
… 5.6 B-Tree Structured Indices Leaf Node Structure A B-tree structure
rm Km … r2 K2 r1 K1 R(K1) R(K2) … A B-tree structure - 10 20 60 70 50 … 3 5 - 52 54 55 - 74 78 61 63 65 69 11 13 14 - 22 23 R(50) R(20) R(10) R(60) R(70) Yunsheng Liu
22
5.7 B+-Tree Structured Indices
Nonleaf Node structure Pn Pn-1 • • • Kn P1 K1 P0 P2 K2 Leaf Node Structure rm Km … r2 K2 r1 K1 Yunsheng Liu
23
5.7 B+-Tree Structured Indices
A B+-tree structure Random access Index Set Sequence Set Record Set B+-tree Data File Sequential access Yunsheng Liu
24
5.8 Hashing File Structures
General Hashing Structure B0 B1 Bn-1 • • • h(ki) ki Hash Function Major Data Area Overflow Area Record slot Block Yunsheng Liu
25
5.8 Hashing File Structures
Bucket Hashing Primary blocks Hashing Function Key KTA Transformation Buckets Bu1 Bu2 Bun • • • Yunsheng Liu
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.