Storage & File Structure

Lecture 9 Β· how a DBMS classifies physical storage, the six media it uses, the storage hierarchy, and how disks are attached to the machine.

Classification criteria

  • Speed with which data can be accessed
  • Cost per unit of data
  • Reliability β€” data loss on power failure or system crash Β· physical failure of the storage device
Volatile storage
Loses its contents when the power is switched off.
cache, main memory
Non-volatile storage
Contents persist even when power is switched off. Includes secondary and tertiary storage, as well as battery-backed-up main memory.

The six media

MediumVolatilitySpeedCostNotes
CacheVolatileFastestMost costlyManaged by the computer system hardware.
Main memoryVolatile10s–100s of nanosecondsExpensiveGenerally too small (or too expensive) to store the entire database; capacities up to a few GB widely used; contents usually lost on power failure or crash.
Flash memoryNon-volatileReads β‰ˆ main memory; writes slow (Β΅s)ModerateData survives power failure. A location can be written once but erased and rewritten; supports only 10K–1M write/erase cycles; erasing is done to a whole bank. Used in cameras, phones, USB keys.
Magnetic diskNon-volatileMuch slower than main memoryCheap per bytePrimary medium for long-term storage; typically stores the entire database. Direct-access. Survives power failures and crashes; disk failure can destroy data, but is rare.
Optical storageNon-volatileSlower than magnetic diskVery cheapRead optically with a laser. CD-ROM (640 MB), DVD (4.7–17 GB), Blu-ray (27–54 GB). WORM disks (CD-R, DVD-R) for archives; RW versions rewritable. Juke-boxes hold large volumes.
Tape storageNon-volatileSequential-access β€” much slower than diskCheapest media (drives are expensive)Used primarily for backup (to recover from disk failure) and archival data. 40–300 GB per tape; jukeboxes store hundreds of terabytes to petabytes.

The storage hierarchy

cachemain memoryflash memorymagnetic diskoptical diskmagnetic tapesFast andExpensiveSlow andCheap Data moves up for access and back down for storage.
LevelAlso calledPropertiesExamples
Primary storageβ€”Fastest media but volatilecache, main memory
Secondary storageon-line storageNon-volatile, moderately fast access timeflash memory, magnetic disks
Tertiary storageoff-line storageNon-volatile, slow access timemagnetic tape, optical storage

Disk subsystem

system busdiskcontrollerdisks
  • Multiple disks connected to a computer system through a controller. Controller functionality (checksum, bad-sector remapping) is often carried out by the individual disks, which reduces the load on the controller.
  • Disk interface standard families: ATA (AT adaptor) Β· SATA (Serial ATA) Β· SCSI (Small Computer System Interconnect) Β· SAS (Serial Attached SCSI) β€” with several variants of each standard at different speeds and capabilities.
Beyond directly-attached disks:
  • SAN (Storage Area Network) β€” a large number of disks connected by a high-speed network to a number of servers; the servers see a disk interface.
  • NAS (Network Attached Storage) β€” networked storage provides a file system interface using a networked file system protocol, instead of a disk system interface.

Next: RAID β€” reliability & performance β†’