Disk
Disk
Disk
Any questions?
This Lecture…
Components of a DBMS…
(primary storage).
Disk for the main database (secondary storage).
(tertiary storage).
Memory Hierarchy
Characteristics of Storage
Medium
Cost Speed
Primary Storage
(main memory,
cache, etc.)
Increase Decrease
Secondary
Storage
(magnetic disks,
optical disks, etc.)
Tertiary Storage
(tapes)
Disks
Secondary storage device of choice.
Main advantage over tapes: random access vs.
sequential.
Data is stored and retrieved in units called disk
blocks or pages.
Unlike RAM, time to retrieve a disk page varies
depending upon location on disk.
Therefore, relative placement of pages on disk has
major impact on DBMS performance!
Components of a Disk Spindle
Tracks
Disk head
The platters spin (say, 90rps).
Sector
Track: concentric rings on platters
Cylinder: the set of all tracks with
the same diameter
Sector: each track is divided into
fixed-sized arcs, called sectors
Block: the unit in which data is Platters
Arm movement
written and read from disk;
block size is a multiple of sector size.
Disk heads: move as a unit;
only one head read/write at
any one time. Arm assembly
Arm assembly: move in or out to
position a disk head
on a desired track.
Components of a Disk
A disk controller is an interface which controls the
disk drive.
Level 0: No redundancy
Uses data striping
Reliability an issue
Best Write Performance (No writing of redundant
data)
RAID Levels… (contd.)
Level 1: Mirrored (two identical copies)
No data striping
read/write a page
Maintaining a Bitmap
Buffer Management in a DBMS
Page Requests from Higher Levels
BUFFER POOL
disk page
free frame
MAIN MEMORY
Pin the page and return its address.
transactions
Each transaction should obtain a lock on
OS does disk space & buffer mgmt: why not let OS manage
these tasks?
Slot M
N 1 . . . 0 1 1M
number M ... 3 2 1 number
PACKED of records UNPACKED, BITMAP of slots
Rid = (i,2)
Rid = (i,1)
20 16 24 N Pointer
N ... 2 1 # slots to start
of free
space
SLOT DIRECTORY
Maintains <record offset, record length> parameters. Offset in
slot directory & length first few bytes of the record or catalog
for fixed length records
Can move records on page without changing rid; so, attractive
for fixed-length records too.
Record Formats: Fixed Length
F1 F2 F3 F4
L1 L2 L3 L4
4 $ $ $ $
Field
Fields Delimited by Special Symbols
Count
F1 F2 F3 F4