How does partition pruning work in BigQuery, and what must a query do to benefit from it?

Quick Overview

Asks how BigQuery decides which partitions of a table to scan and which query patterns let it skip the rest. Tests whether you can write filters that keep scan cost low and confirm the effect before running a query.

How does partition pruning work in BigQuery, and what must a query do to benefit from it?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Other

How does partition pruning work in BigQuery, and what are the requirements for a query to make effective use of it? ```hint When the decision is made Think about when BigQuery decides which partitions to read, and what it must already know about the filter value at that moment. ``` ### What a Strong Answer Covers - When pruning happens and what it saves. - The conditions a filter must meet for pruning to apply. - Query patterns that defeat pruning, with examples. - How to confirm that pruning happened, and how to require partition filters on a table. ### Follow-up Questions - How does clustering differ from partitioning in the way BigQuery skips data, and why is a dry-run estimate on a clustered filter only an upper bound? - A dashboard query filters on `event_date >= (SELECT DATE_SUB(MAX(event_date), INTERVAL 7 DAY) FROM t)`. How would you rewrite it so it prunes? - What does the `require_partition_filter` table option do, and when would you turn it on? - How would you choose between daily, hourly and integer-range partitioning for a large event table?

Overview: Asks how BigQuery decides which partitions of a table to scan and which query patterns let it skip the rest. Tests whether you can write filters that keep scan cost low and confirm the effect before running a query.

Nov 24, 2026
mediumData ScientistOtherData Manipulation (SQL/Python)
0
0

How does partition pruning work in BigQuery, and what are the requirements for a query to make effective use of it?

What a Strong Answer Covers Guidance

  • When pruning happens and what it saves.
  • The conditions a filter must meet for pruning to apply.
  • Query patterns that defeat pruning, with examples.
  • How to confirm that pruning happened, and how to require partition filters on a table.

Follow-up Questions Guidance

  • How does clustering differ from partitioning in the way BigQuery skips data, and why is a dry-run estimate on a clustered filter only an upper bound?
  • A dashboard query filters on event_date >= (SELECT DATE_SUB(MAX(event_date), INTERVAL 7 DAY) FROM t) . How would you rewrite it so it prunes?
  • What does the require_partition_filter table option do, and when would you turn it on?
  • How would you choose between daily, hourly and integer-range partitioning for a large event table?