Part 4 of 4 · 3 min read
Exercises
Easy
Easy 1: Name the two media (15 minutes)
Name the two kinds of persistent storage media covered in this module.
Done when: magnetic disks and SSDs are both named.
Hint
Magnetic disks and solid-state drives (SSDs).
Easy 2: Define seek time (15 minutes)
Explain, in one sentence, what seek time is.
Done when: the explanation correctly describes the time a physical head spends moving before reading.
Hint
Seek time is the time a magnetic disk's physical head spends moving into position before it can read.
Easy 3: Sequential or random (15 minutes)
State whether reading a table's rows in exactly the order they were originally written is sequential or random access.
Done when: sequential is correctly identified.
Hint
Sequential, since it follows the rows' natural stored order with no jumping around.
Medium
Medium 1: Predict relative speed (25 minutes)
Predict which runs faster on a magnetic disk: reading 1,000 contiguous rows, or reading 1,000 randomly scattered rows, and explain why.
Done when: contiguous reading is correctly predicted as faster, citing seek time avoided.
Hint
Contiguous reading is faster, since it avoids paying seek time for every row individually.
Medium 2: Predict the SSD difference (25 minutes)
Predict how much that same speed difference shrinks when both reads instead run on an SSD, and explain why.
Done when: the explanation correctly notes the gap shrinks substantially, since there is no physical head to reposition.
Hint
The gap shrinks substantially on an SSD, since there is no physical head that needs to travel between locations.
Medium 3: A design choice explained by hardware (25 minutes)
Explain how the fact that sequential access is faster on a magnetic disk helps explain why databases are often designed to favor large, sequential writes over many small scattered ones.
Done when: the explanation correctly ties the sequential-write preference back to minimizing seek time on spinning media.
Hint
Favoring large, sequential writes reduces the number of times a magnetic disk's head must reposition, directly reducing total seek time paid.
Hard
Hard 1: Why SSDs didn't eliminate blocks entirely (30 minutes)
Explain why databases still organize storage in fixed-size blocks, even running entirely on SSDs with no seek time penalty to avoid.
Done when: the explanation correctly notes flash memory has its own internal page and erase-block structure, and that block-based I/O remains an efficient unit of transfer for other reasons, such as matching the operating system's own page size.
Hint
Flash memory itself is organized into pages and erase blocks internally, and block-based I/O still matches other system boundaries efficiently, such as the operating system's own page size, independent of seek time concerns.
Hard 2: A workload that still prefers magnetic disks (35 minutes)
Describe a realistic storage workload where a magnetic disk's much lower cost per gigabyte could still make it the practical choice over an SSD, despite its slower random access.
Done when: a realistic workload is described, such as cold archival backups rarely read randomly, where cost per gigabyte matters more than random-access speed.
Hint
Long-term archival backups, read rarely and almost never randomly, can favor a magnetic disk's much lower cost per gigabyte over an SSD's speed advantage that mostly goes unused there.
Hard 3: Diagnosing a slow query from a hardware angle (40 minutes)
A query scanning a large table runs much slower than expected on a server using a magnetic disk, and the team wants a first hypothesis before digging into the query plan itself. Propose a hardware-level hypothesis worth checking first.
Done when: a hypothesis is proposed around the query's access pattern being more random than expected for this storage medium, worth checking before assuming the query plan itself is at fault.
Hint
Checking whether the query's actual access pattern is more random (scattered reads) than assumed is a reasonable first hardware-level hypothesis, worth ruling out before assuming the query plan itself is the problem.