BEGIN; BEGIN EXPLAIN select 100.00 * sum(case when p_type like 'PROMO%' then l_extendedprice * (1 - l_discount) else 0 end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue from lineitem, part where l_partkey = p_partkey and l_shipdate >= date '1996-09-01' and l_shipdate < cast(date '1996-09-01' + interval '1 month' as date); QUERY PLAN -------------------------------------------------------------------------------------------------------------- Finalize Aggregate (cost=1612533.04..1612533.05 rows=1 width=32) -> Gather (cost=1612532.80..1612533.01 rows=2 width=64) Workers Planned: 2 -> Partial Aggregate (cost=1611532.80..1611532.81 rows=1 width=64) -> Parallel Hash Join (cost=65410.40..1606189.75 rows=305317 width=33) Hash Cond: (lineitem.l_partkey = part.p_partkey) -> Parallel Seq Scan on lineitem (cost=0.00..1531298.89 rows=305317 width=16) Filter: ((l_shipdate >= '1996-09-01'::date) AND (l_shipdate < '1996-10-01'::date)) -> Parallel Hash (cost=49296.51..49296.51 rows=833351 width=25) -> Parallel Seq Scan on part (cost=0.00..49296.51 rows=833351 width=25) (10 rows) COMMIT; COMMIT