Skip to main content

Command Palette

Search for a command to run...

Predicate pushdown

Published
3 min readView as Markdown

Predicate pushdown is a technique used to optimize query performance by pushing down filtering operations (predicates) to the storage layer. This allows the storage layer to filter the data before it is returned to the query engine, which reduces the amount of data that needs to be processed and improves query performance.

Predicate pushdown is used in situations where the query engine is not able to make use of indexes or other optimizations to filter the data quickly. By pushing down the predicates to the storage layer, the data can be filtered at the source, reducing the amount of data that needs to be transferred to the query engine and processed.

For example, when a query is made with a WHERE clause like WHERE column1 = 'value1', the query engine can push down this predicate to the storage layer, which can then filter the data and return only the rows that match the predicate before passing them back to the query engine.

Predicate pushdown is particularly useful in distributed systems like big data platforms, where the query engine and the storage layer run on separate machines. By pushing down predicates, the system can reduce the amount of data that needs to be transferred over the network, which improves query performance and reduces network congestion.

The diagram shows the flow of predicate pushdown. The query engine sends a query with a filter predicate to the storage layer. The storage layer applies the filter predicate to the data and returns only the relevant data back to the query engine.

This process of pushing the filter predicate to the storage layer, allows the storage layer to filter the data before it is returned to the query engine, which reduces the amount of data that needs to be processed by the query engine and improves query performance.

Example with WHERE clause

It consists of three main components: the query engine, the storage layer, and the data source.

  • The query engine receives a query from the user, which includes a WHERE clause with one or more predicates.

  • The query engine then pushes down the predicates to the storage layer, which can be a distributed file system or a database.

  • The storage layer filters the data based on the predicates and returns only the relevant data to the query engine.

  • The query engine then performs additional operations such as sorting, aggregation, and joining on the filtered data.

  • Finally, the query engine returns the results to the user.

It is important to note that Predicate pushdown can be applied not only to the storage layer but also to other layers that are in the data path, such as indexing or caching layers.