Problems / Avoid Cartesian Product / Editorial
The critical optimization is ensuring the join is an equi-join, not a cartesian product:
dept_id
Common mistakes that create accidental cross joins:
FROM employees, departments
With 30 employees and 5 departments:
At production scale (1M × 100), the cross join produces 100M rows, likely causing OOM errors or hour-long queries.
Solve Avoid Cartesian Product yourself →