Consider a query
Here, cond1(col) can be pushed down from HAVING into WHERE clause. cond2(agg_func(..)) cannot be pushed down.
Basically, we can push down conditions that remain constant across the GROUP BY groups. Pushdown allows to filter out the whole groups.
This task is about
- splitting the condition that can be pushed down
- moving from HAVING into WHERE, adjusting it appropriately