The interview problem

Practice prompt

A query engine reads terabytes to answer selective date-and-region queries. Design column and row-group pruning and explain when statistics are ineffective.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Assume a columnar format with valid per-group statistics and explicit null semantics. Read metadata first, select needed columns and skip groups whose bounds prove the predicate impossible. Keep partition metadata and file statistics tied to immutable file versions. Order or cluster data to improve useful ranges, but retain a correctness-preserving full-scan fallback when statistics are absent or unsupported. Predicate evaluation still runs on surviving rows.

2. Trace the design or derivation

Read file metadata
  → select columns
  → exclude impossible groups
  → filter surviving rows

For predicate amount greater than 100, a group whose maximum is 80 can be skipped; a group with range 20 to 200 must be read even if no row ultimately matches. Unknown or invalid statistics mean keep the group. This one-sided rule makes pruning conservative and correct.

3. Calculate the example

A 1 TB table with ten equally sized columns needs roughly 200 GB of column payload for two columns before compression effects. If valid statistics exclude 90% of the relevant row groups, the remaining payload is roughly 20 GB. This multiplication assumes evenly distributed bytes; skewed columns or groups change the estimate.

4. Failure cases and trade-offs

A min/max range spanning the entire value domain prunes nothing even if few rows match. Incorrect timezone conversion or truncated string statistics can cause unsafe skips. Smaller row groups improve pruning granularity but increase metadata and may reduce compression efficiency. Pruning is an optimization, not a substitute for final filtering.

5. Validation, follow-ups and self-review

Compare pruned and full scans on nulls, boundary timestamps and skewed groups. Measure bytes read, not just row counts. Follow-up: how would sorting by date affect a region-only query? Reward sound exclusion logic and qualified I/O estimates.

Sources and related practice

Technical reference: parquet.apache.org — Columnar files and row-group structure.

Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Execute analytical queries across workers; Change a large database schema without stopping writes.

Continue your preparation

Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.