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
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.
Contents persist even when power is switched off. Includes secondary and tertiary storage, as well as battery-backed-up main memory.
The six media
| Medium | Volatility | Speed | Cost | Notes |
|---|---|---|---|---|
| Cache | Volatile | Fastest | Most costly | Managed by the computer system hardware. |
| Main memory | Volatile | 10sβ100s of nanoseconds | Expensive | Generally 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 memory | Non-volatile | Reads β main memory; writes slow (Β΅s) | Moderate | Data 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 disk | Non-volatile | Much slower than main memory | Cheap per byte | Primary 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 storage | Non-volatile | Slower than magnetic disk | Very cheap | Read 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 storage | Non-volatile | Sequential-access β much slower than disk | Cheapest 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
| Level | Also called | Properties | Examples |
|---|---|---|---|
| Primary storage | β | Fastest media but volatile | cache, main memory |
| Secondary storage | on-line storage | Non-volatile, moderately fast access time | flash memory, magnetic disks |
| Tertiary storage | off-line storage | Non-volatile, slow access time | magnetic tape, optical storage |
Disk subsystem
- 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.