Prune Micro-Partitions Using Min and Max Column Metadata
Last updated: November 29, 2026
Quick Overview
Each micro-partition stores the min and max of a column (or null bounds when every value is null). Given a range predicate lo <= col <= hi, return the ids of partitions that might contain a matching row so the scan can skip the rest.
Snowflake
November 29, 20260
0
0 solved
Each micro-partition stores the min and max of a column (or null bounds when every value is null). Given a range predicate lo <= col <= hi, return the ids of partitions that might contain a matching row so the scan can skip the rest.
A warm-up in the style of Snowflake phone screens, built around the zone-map pruning that makes Snowflake scans cheap. The interviewer checks that you reason about overlap correctly, handle null-only partitions, and can talk about how pruning scales to millions of partitions.
What the Interviewer Expects
- States the interval overlap condition precisely: keep unless max < lo or min > hi
- Handles partitions whose column is entirely null by skipping them for a non-null predicate
- Explains that pruning may keep false positives but must never drop a true match
- Gives O(P) time and discusses sorting by min for faster lookups
- Mentions inclusive versus exclusive bounds
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you answer many range queries quickly if partitions were sorted by min value?
- How do you extend this to a conjunction of predicates on two columns?
- What happens to pruning effectiveness when the table is poorly clustered?
- How would you handle IS NULL predicates?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: a list of partitions (pid, min, max, null_count, row_count) and an inclusive range [lo, hi]. Output: partition ids that may contain a value in range, in input order. Pruning is allowed to b...
High-Level Design
A partition can be skipped only if its value range and the query range are disjoint: max < lo (everything is below) or min > hi (everything is above). Otherwise they overlap and the partition must...