Request a demo

BigQuery error · Query and syntax errors

Cannot query over table without a filter for partition elimination

The table has require_partition_filter enabled, a cost guardrail that rejects any query that would read every partition. Add a WHERE condition that compares the partitioning column with a constant. The query fails at analysis, so nothing is billed.

Error reason invalidQuery · HTTP 400 · Checked against the Google Cloud docs in November 2026

The error message

Cannot query over table '<project>.<dataset>.<table>' without a filter over column(s) '<partition_column>' that can be used for partition elimination

Causes

No filter on the partitioning column

With require_partition_filter = TRUE, every query on the table, and on views and materialized views that read it, must contain a predicate that references only the partitioning column. The owner of the table set this on purpose to stop full scans. Some docs pages show the shorter variant without a filter that can be used for partition elimination.

The filter is combined with OR

WHERE event_date = '2026-11-22' OR user_id = 42 can't eliminate partitions, because rows from any partition might match the second condition. The partition predicate has to be one of the AND-ed conditions.

The filter is on a different column

Filtering on created_at when the table is partitioned by event_date, or on a column derived from the partition column inside a subquery, doesn't count. For ingestion-time partitioned tables the column is _PARTITIONTIME or _PARTITIONDATE.

The filter is on the joined table only

In a join, each partitioned table that requires a filter needs its own predicate. A date filter on the other side of the join doesn't satisfy the requirement for this table.

How to fix it

1. Add a constant filter on the partitioning column

Compare the column to literals, CURRENT_DATE() arithmetic or query parameters. Only the matching partitions are read and billed.

SELECT user_id, event_name, event_ts
FROM `project.dataset.events`
WHERE event_date BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY) AND CURRENT_DATE()
  AND event_name = 'purchase';

2. Keep the partition predicate outside OR

Put the partition condition at the top level and move the OR inside parentheses.

SELECT order_id, status
FROM `project.dataset.orders`
WHERE order_date >= '2026-11-01'
  AND (status = 'refunded' OR amount < 0);

3. Use a script variable instead of a subquery

A partition column compared with a subquery over another table, such as (SELECT MAX(load_date) FROM ...), is a dynamic value and doesn't prune. Compute the value first, then use it as a constant.

DECLARE last_load DATE DEFAULT (
  SELECT MAX(load_date) FROM `project.dataset.load_log`
);

SELECT *
FROM `project.dataset.events`
WHERE event_date = last_load;

4. Turn the requirement off only if full scans are intended

Table owners can change the option. Do this only for small tables; on a large table the guardrail is what keeps an ad hoc query from scanning years of data.

ALTER TABLE `project.dataset.events`
SET OPTIONS (require_partition_filter = FALSE);

How to prevent it

  • Enable require_partition_filter on every large partitioned table that people query ad hoc. It turns an accidental full scan into a free analysis error.
  • Give analysts views that already filter the recent partitions, for example the last 30 days.
  • Use a dry run to check that a new query prunes partitions: the estimated bytes should match the date range, not the whole table.

FAQ

Is a query that fails with this error billed?

No. It fails during query analysis, before any data is read, so neither on-demand bytes nor editions slot time are spent. That's why the option is a useful spend guardrail.

How do I see which tables require a partition filter?

Query INFORMATION_SCHEMA.TABLE_OPTIONS in the dataset for option_name = 'require_partition_filter', or check the table details in the console.

Does a filter on a clustered column satisfy the requirement?

No. Only a predicate on the partitioning column counts. Clustering reduces bytes read inside the selected partitions but doesn't replace the partition filter.

SQL reference

More query and syntax errors

All BigQuery error messages · What 50M daily events say about BigQuery failures

Stop finding BigQuery failures in Slack threads

Masthead watches every BigQuery job, dbt model, Dataform action and Airflow task from audit logs, groups failures into incidents and shows which tables and dashboards are affected. No access to your data and no added BigQuery cost.