Compaction Strategies: Size-Tiered, Leveled, and Time-Window Quiz Quiz

Explore essential principles behind Size-Tiered, Leveled, and Time-Window compaction strategies with this quiz, designed to strengthen your understanding of key techniques in data storage and management. Assess your knowledge of compaction approaches, their advantages, trade-offs, and typical use cases in modern database systems.

  1. Purpose of Compaction

    What is the main goal of compaction in data management systems?

    1. To prevent any form of data deletion
    2. To reorganize and merge stored data for improved efficiency
    3. To slow down query performance intentionally
    4. To increase data redundancy for safety

    Explanation: The main purpose of compaction is to reorganize and merge fragmented or outdated data, improving storage efficiency and query speed. Increasing redundancy may improve reliability but is not the primary purpose of compaction. Intentionally slowing down queries or preventing all data deletion are not goals of compaction strategies.

  2. Size-Tiered Compaction Output

    Which best describes the output of a size-tiered compaction strategy?

    1. Files always sorted by time only
    2. A few large files created by merging similarly sized smaller files
    3. Files split strictly by data type
    4. Many tiny files with each compaction

    Explanation: Size-tiered compaction merges groups of similarly sized files into larger ones, reducing overall file count and fragmentation. Creating many tiny files would be inefficient and is not the goal. Sorting only by time or splitting by data type are not features of size-tiered compaction.

  3. Leveled Compaction Characteristic

    What characterizes the leveled compaction strategy in terms of file organization?

    1. Files are merged only once a month
    2. Files are organized into levels with limited overlap in key ranges
    3. All files are always the same size, regardless of content
    4. Data is never removed from storage

    Explanation: Leveled compaction arranges files into levels where files at the same level have minimal or no overlapping key ranges, making lookups efficient. Having all files the same size is not required, and data removal and merge frequencies are determined by other system policies, not core characteristics.

  4. Time-Window Compaction Scenarios

    In which scenario is time-window compaction typically most beneficial?

    1. When all data needs to be permanently retained
    2. When merging unrelated data types is a priority
    3. When data is organized randomly without time relevance
    4. When data is ingested and queried by recent time intervals

    Explanation: Time-window compaction excels where most queries focus on recent data, such as log data where records are consumed and dropped by time periods. Permanent retention or random data organization reduces the effectiveness of this strategy, and merging by unrelated data types is not its purpose.

  5. Write Amplification in Leveled Compaction

    Compared to size-tiered compaction, leveled compaction tends to result in which outcome?

    1. No change in write amplification at any scale
    2. Higher write amplification due to repeated data movement across levels
    3. Data is never rewritten once stored
    4. Lower write amplification because data is merged less often

    Explanation: Leveled compaction frequently rewrites data across multiple levels, resulting in higher write amplification. Size-tiered compaction generally moves data less frequently. No change or lack of any rewriting is not accurate, as data movement is intrinsic to compaction.

  6. Query Performance Comparison

    Which compaction strategy typically offers the fastest point lookup query performance?

    1. No compaction at all
    2. Leveled compaction
    3. Random-tiered compaction
    4. Size-tiered compaction

    Explanation: Leveled compaction reduces key overlap between files in higher levels, leading to faster point lookups since fewer files need checking. Size-tiered often has more overlap, causing more files to be examined. Lack of compaction slows queries, and random-tiered is not a recognized strategy.

  7. Impact of Compaction on Storage Space

    How does time-window compaction help optimize storage space usage?

    1. By merging random files without checking age
    2. By duplicating all data across every window
    3. By allowing expired data within a time window to be dropped quickly
    4. By avoiding any file merges entirely

    Explanation: Time-window compaction simplifies the removal of expired data by grouping data into time-based files that can be purged efficiently. Duplicating data, merging randomly, or skipping merges would waste space or reduce efficiency rather than optimize it.

  8. Typical Use Case for Size-Tiered Compaction

    Which of the following is a common use case for size-tiered compaction?

    1. Systems where only one file can exist at a time
    2. High-insert workloads where bulk write speed is important
    3. Read-heavy applications needing fast lookups
    4. Workloads requiring strict time-based data grouping

    Explanation: Size-tiered compaction is ideal for high-insert workloads, as merging similarly sized files in batches enhances write performance. For read-focused scenarios or strict time requirements, leveled or time-window strategies work better. Systems limited to a single file per time are unrelated.

  9. Leveled vs. Size-Tiered Read Amplification

    Which compaction strategy typically results in lower read amplification?

    1. Size-tiered compaction
    2. No compaction
    3. Leveled compaction
    4. Full-windowed compaction

    Explanation: Leveled compaction organizes files so that a point query examines fewer files, lowering read amplification. Size-tiered may require searching through multiple overlapping files for a single key. No compaction increases file counts and read costs, and full-windowed is not a standard term.

  10. Trade-Off of Time-Window Compaction

    What is a main trade-off when using time-window compaction?

    1. Frequent deletion of data before it is stored
    2. Old data might not be compacted as efficiently, leading to higher storage for historical periods
    3. All data must fit in a single window
    4. Query speed for recent data is always slower

    Explanation: Time-window compaction prioritizes recent data and can leave older data fragmented, resulting in higher storage utilization over time. Query speed for recent data is generally fast, not slow. Data fitting into a single window and deleting data before storage are not requirements of this strategy.