Problem Statement
Explain filter pushdown and why reducing rows early helps most query plans.
Explanation
Filter pushdown means applying selective predicates as close to the base tables as possible. This prevents unnecessary row explosion in joins and reduces the amount of data flowing to sorts, aggregates, and window operations.
Smaller inputs improve cache locality, cut memory use, and allow different join algorithms. The effect is multiplicative across multi-join plans, so early reduction often yields the biggest gains.
Code Solution
SolutionRead Only
SELECT ... FROM orders o JOIN items i ON i.order_id=o.id WHERE o.status='PAID' AND o.created_at>=CURRENT_DATE-INTERVAL '30 days';
Practice Sets
This question appears in the following practice sets:
