Problems / Filter Before Join / Editorial
The naive approach joins the full orders table (200 rows) with the full customers table (20 rows), then filters the result. The optimized approach filters each table first:
completed
West
In production with millions of rows, filtering before joining can reduce intermediate result sizes by orders of magnitude. Most query optimizers attempt predicate pushdown automatically, but writing explicit CTEs makes the intent clear and guarantees the optimization regardless of engine.
Solve Filter Before Join yourself →