Glossary

What is predicate pushdown?

Predicate pushdown is a query optimization that moves a filter, the predicate in a WHERE clause, down to where the data is read. The file scan or the source database then discards data that cannot match before it reaches the query engine, so less is read from disk, sent over the network and processed.

Where the filter runs

A naive plan reads every row and then filters. With pushdown, the optimizer hands the filter to the lowest layer that can evaluate it. What that layer can do depends on the source:

SourceWhat gets pushedWhat it saves
Parquet filesThe filter is checked against each row group's min/max statisticsRow groups whose range can't match are never read
Hive-partitioned foldersFilters on the partition columnsWhole files and folders are skipped
Iceberg tablesFilters checked against partition values and per-file statistics in the manifestsData files are skipped before they're opened
PostgreSQL, MySQL, BigQueryThe WHERE clause, rewritten into the query sent to the sourceOnly matching rows cross the network

An example in DuckDB

This writes 10 million orders to Parquet, ordered by date, in row groups of 122,880 rows. EXPLAIN shows the filter inside the scan, and the file's metadata shows how much of it the filter can rule out.

DuckDB
COPY (
  SELECT range                                   AS id,
         range % 1000                            AS customer_id,
         round(random() * 100, 2)::DECIMAL(10,2) AS amount,
         DATE '2026-01-01' + (range // 27398)::INT AS order_date
  FROM range(10_000_000)
) TO 'orders.parquet' (FORMAT parquet, ROW_GROUP_SIZE 122880);

-- The filter shows up inside PARQUET_SCAN, under "Filters"
EXPLAIN
SELECT sum(amount) FROM 'orders.parquet'
WHERE order_date = DATE '2026-06-01';

-- How many row groups could hold that date, judging by min/max?
SELECT count(*) AS row_groups_that_can_match
FROM parquet_metadata('orders.parquet')
WHERE path_in_schema = 'order_date'
  AND stats_min_value <= '2026-06-01'
  AND stats_max_value >= '2026-06-01';

The file has 82 row groups, and only 1 can hold that date. On a laptop the date query returns 27,398 rows in about 1 ms. Filtering on customer_id = 42 instead returns fewer rows, 10,000, but takes about 9 ms: every row group holds customer IDs from 0 to 999, so the statistics rule out none of them and all 82 are read. The filter was pushed in both cases. It only saved work where the data's layout let the statistics exclude something.

When pushdown doesn't help

  • The source can't evaluate the filter. A condition that references another table, a subquery result, or a function the remote database doesn't have stays in the engine, and the source sends everything.
  • The statistics can't exclude anything. An unsorted column has a wide min/max in every block, as with customer_id above.
  • The value changes during the query. Engines often keep now() and similar functions local rather than send them to another system.

The usual fix for the first case is to compute the value in one query and write it as a literal in the next. For the second, sort or partition the data on the columns people filter by. See Hive partitioning and Parquet.

In Thunderduck

On PostgreSQL, MySQL and BigQuery catalogs, Thunderduck pushes filters that compare a column with constants into the source, plus GROUP BY, ORDER BY and LIMIT when the remote table is alone in its SELECT. current_date arithmetic in days is pushed as a plain date, evaluated once in UTC. now(), month and year intervals, function calls on the column, and anything that references another table or a subquery stay local. For an incremental load, read the high-water mark in one statement and write it as a literal in the next.

Iceberg reads skip files using partition values and min/max statistics. For Parquet files in S3, GCS, Azure or R2, a filter on a column the files are sorted or partitioned by reads only the files and row groups that can match.

Docs: https://docs.thunderduck.ai/data/loading/

Related terms

Query the data where it lives.

Databases, warehouses and buckets in one SQL statement, from SQL clients, BI tools and AI agents.