Docsity

Physical Storage Media and Disk Organization: Magnetic Disks and Optimization - Prof. Davi, Study notes of Principles of Database Management

Toggle sidebar
bg1
Recap of Feb 20: Database Design
Goals, Normalization, Normal Forms
•Goals for designing a database: a schema with:
–simple, easy to phrase queries
–avoids redundancies (repetition of information)
–avoids anomalies
–good performance
•Normalization
–decompose complex relations
–Lossy decompositions
–Functional Dependencies
•Normal Forms: 1NF, 2NF, 3NF, BCNF
–BCNF or 3NF: lossless decomposition in both
•BCNF can’t always ensure dependency preservation
•3NF sometimes requires null values or redundant information
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Partial preview of the text

Download Physical Storage Media and Disk Organization: Magnetic Disks and Optimization - Prof. Davi and more Study notes Principles of Database Management in PDF only on Docsity!

Recap of Feb 20: Database Design

Goals, Normalization, Normal Forms

  • Goals for designing a database: a schema with:
    • simple, easy to phrase queries
    • avoids redundancies (repetition of information)
    • avoids anomalies
    • good performance
  • Normalization
    • decompose complex relations
    • Lossy decompositions
    • Functional Dependencies
  • Normal Forms: 1NF, 2NF, 3NF, BCNF
    • BCNF or 3NF: lossless decomposition in both
      • BCNF can’t always ensure dependency preservation
      • 3NF sometimes requires null values or redundant information

Getting Physical: Storage and File

Structure (Chapter 11)

  • Up until now we have examined database design from a

high-level conceptual view, passing over actual

implementation and underlying hardware.

  • Appropriate focus for database users
  • But hardware does have an influence on implementation, and implementation does have an influence on what conceptual designs will be more efficient and useful
  • Now we get physical -- examine physical storage media to

give a background for later focus on implementation of the

data models and languages already described

Midterm!

  • As per the syllabus, the Midterm will cover the pre-midterm lecture notes plus sections 1,2,3 (except 3.4 & 3.5), 4, 6, 7-7.7, 11 (except 11.3 and 11.9) of the text
  • We have examined all that material except chapter 11, which starts today
  • Scheduling the midterm depends upon the speed with which we get through the material.
  • It looks as if we’ll have enough time to schedule one day for review before the midterm
  • My current guess is that we might be able to schedule the midterm as early as March 13; certainly no later than March 20. I’m aiming for Tuesday, March 18.

Midterm Study and Homework

  • Material you are responsible for:
    • All material presented in class before the midterm
    • Textbook sections 1,2,3 (except 3.4 & 3.5), 4, 6, 7-7.7, 11 (except 11. and 11.9)
  • The homework questions from assignment 1 (exercises 1.1, 1.2, 1.3, and 2.1-2.6) are all useful study aids, as are the questions from homework assignment #2: - 3.2, 3.3, 3.5, 3.6 -- 3.9, 3. - 4.1, 4.2, 4.4 -- 4. - 7.2, 7.4, 7.5, 7.11, 7.12, 7.15, 7.16, 7.21, 7.
  • Homework #2 is due Tuesday, March 11. I’ll try to have them back to you, graded, Thursday March 13 so you can use them as a study aid for the exam Tuesday, March 18.

Physical Storage Media Overview (11.1)

  • Typical media available are:
    • Cache
    • Main memory
    • Flash memory
    • Mag disk
    • Optical storage (CD or DVD)
    • Tape storage

Physical Storage Media -- Cache and

Main Memory

  • Cache
    • fastest and most costly form of storage
    • volatile
    • managed by computer system hardware
  • Main memory
    • fast access (10s to 100s of nanoseconds)
    • generally too small or expensive to hold the entire database
      • current capacities commonly used are up to a few Gigabites
      • capacities have gone up and per-byte costs have decreased steadily, roughly a factor of 2 every 2-3 years
    • volatile

Physical Storage Media -- Magnetic Disk

  • data is stored on a spinning disk and read/written magnetically
  • primary medium for long-term storage of data
  • typically stores entire database
  • data must be moved from disk to main memory for access, and written back for storage - much slower access than main memory (about which more later)
  • direct access -- possible to read data on disk in any order, unlike magnetic tape
  • capacities up to 100 gig
    • much larger capacity and cheaper cost/byte than main memory or flash memory
    • capacity doubles every two or three years
  • survives power failures and system crashes
    • disk failure can destroy data, but this is more rare than system crashes

Physical Storage Media -- Optical

Storage

  • Non-volatile; data is read optically from a spinning disk using a laser
  • CD-ROM (640 MB) and DVD (4.7 to 17 GB) most popular forms
  • Write-once, Read-many (WORM) optical disks used for archival storage (CD-R and DCD-R)
  • Multiple-write versions also available (CD-RW, DVD-RW, and DVD- RAM)
  • Reads and writes are slower than with magnetic disk
  • Juke-box systems available for storing large volumes of data
    • large numbers of removable disks
    • several drives
    • mechanism for automatic loading/unloading of disks

Storage Hierarchy

  • Primary storage: fastest media but volatile - cache - main memory
  • secondary storage: next level in hierarchy; moderately fast access time, non-volatile - also called on-line storage - flash memory, magnetic disks
  • tertiary storage: lowest level in hierarchy; slower access time, non- volatile - also called off-line storage - optical storage, magnetic tape

Magnetic Disks (11.2)

  • Read-write head
    • positioned very close to the platter surface (almost touching it)
    • Reads or writes magnetically coded information
  • Surface of platter divided into circular tracks - over 16,000 tracks per platter on typical hard disks
  • Each track is divided into sectors
    • a sector is the smallest unit of data that can be read or written
    • sector size is typically 512 bytes
    • typically 200 (on inner tracks) to 400 (outer tracks) sectors per track

Magnetic Disks (cont)

  • Earlier generation disks were susceptible to head crashes
    • disk spins constantly at 60, 120, even 250 revolutions per second
    • head is very close to the surface; if it touches the surface it can scrape the recording medium off the surface, wiping out data and causing the removed medium to fly around, causing more head crashes
    • newer disks have less friable material; less subject to head crashes

Magnetic Disks (cont)

  • Disk controller -- interfaces between the computer system and the disk drive - accepts high-level commands to read or write a sector - initiates actions such as moving the disk arm to the right track and actually reading or writing the data - computes and attaches checksums to each sector to verify that data is read back correctly - Ensures successful writing by reading back sector after writing it - Performs remapping of bad sectors - Multiple disks are connected to a computer system through a controller - controllers functionality (checksum, bad sector remapping) often carried out by individual disks, reducing load on controller - Two disk interface standards are ATA (AT attachment) and SCSI (Small Computer System Interconnect)

Disk Performance Measures (cont.)

  • Mean time to failure (MTTF) - the average time the disk is expected to run continuously without any failure. - Typically 3-5 years - Sounds good, but if you have 1500 disks then 300 per year will fail, or about 1 per day - MTTF decreases as the disk ages
  • RAID (Redundant Arrays of Independent Disks) ( 11.3 )
    • disk organization techniques that manage a large number of disks, providing a view of a single disk of - high capacity and high speed by using multiple disks in parallel - high reliability by storing data redundantly, so that data can be recovered even if a disk fails - MTTdata loss can be as high as 500,000 to 1,000,000 hours on a RAID

Optimization of Disk-Block Access:

Motivation

  • Requests for disk I/O are generated both by the file system and by the virtual memory manager
  • Each request specifies the address on the disk to be referenced in the form of a block number - a block is a contiguous sequence of sectors from a single track on one platter - block sizes range from 512 bytes to several K (4 -- 16K is typical) - smaller blocks mean more transfers from disk; larger blocks makes for more wasted space due to partially filled blocks - block is the standard unit of data transfer between disk to main memory
  • Since disk access speed is much slower than main memory access, methods for optimizing disk-block access are important