SET enable_partition_wise_join TO true; EXPLAIN (COSTS false) SELECT b.j, avg(b.v + c.v) FROM b JOIN c ON b.j = c.k GROUP BY b.j;