Log-Structured Storage and Compaction · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.

Write fast now, tidy up later

Computing · Data & Databases · ages 22-24
Name ______________________   Date ____________
  1. Key k has an old copy in a run and a new copy in the memory table. Which value wins?

    • The oldest copy, it was written first
    • A mix of both copies
    • The newest copy in the memory table
  2. Where does a fresh write go first?

    • Into the oldest run on disk
    • Directly into a compacted level
    • Into the memory table
  3. Compaction merges sorted runs and drops shadowed copies.

    Circle one:   True   False

  4. A workload writes constantly and rarely reads. Which policy fits?

    • Tiered merging, which merges rarely
    • Leveled merging, which merges often
    • No compaction at all
  5. A read looks for a key stored in three runs. What must it do?

    • Check newest first and stop at the first copy found
    • Check oldest first and return the last copy
    • Read all three and average the values
  6. A run membership filter says the key is absent. What should the read do?

    • Scan the run anyway to be sure
    • Skip the run entirely
    • Compact the run first
  7. Reads are slow and each key spans many runs. Which change helps most?

    • Flush the memory table less often
    • Move toward leveled merging plus filters
    • Drop the membership filters to save memory
  8. Pat says leveled merging rewrites data less than tiered merging. What is wrong?

    • Leveled merging rewrites more, that is its price for short reads
    • Tiered merging never merges at all
    • Rewrites have no effect on write cost
LightMySky · lightmysky.comW1-mt_MDZ7MPNEhO-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

Write fast now, tidy up later W1-mt_MDZ7MPNEhO-s1

  1. The newest copy in the memory table · Newer copies shadow older ones.
  2. Into the memory table · All writes start in memory, then flush as runs.
  3. True · That tidy-up is the whole job of compaction.
  4. Tiered merging, which merges rarely · Rare merges keep write costs low.
  5. Check newest first and stop at the first copy found · Newest-first order finds the winning copy fast.
  6. Skip the run entirely · A no from the filter rules that run out.
  7. Move toward leveled merging plus filters · Fewer runs plus skippable runs shorten reads.
  8. Leveled merging rewrites more, that is its price for short reads · Frequent merges are exactly what leveled pays with.
Worksheet · LightMySky