BEGIN; BEGIN EXPLAIN select l_shipmode, sum(case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1 else 0 end) as high_line_count, sum(case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_count from orders, lineitem where o_orderkey = l_orderkey and l_shipmode in ('REG AIR', 'SHIP') and l_commitdate < l_receiptdate and l_shipdate < l_commitdate and l_receiptdate >= date '1996-01-01' and l_receiptdate < date '1996-01-01' + interval '1 year' group by l_shipmode order by l_shipmode; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (cost=2217343.81..2219792.59 rows=7 width=27) Group Key: lineitem.l_shipmode -> Gather Merge (cost=2217343.81..2219792.42 rows=14 width=27) Workers Planned: 2 -> Partial GroupAggregate (cost=2216343.79..2218790.78 rows=7 width=27) Group Key: lineitem.l_shipmode -> Sort (cost=2216343.79..2216649.65 rows=122346 width=27) Sort Key: lineitem.l_shipmode -> Parallel Hash Join (cost=445729.68..2203075.68 rows=122346 width=27) Hash Cond: (lineitem.l_orderkey = orders.o_orderkey) -> Parallel Seq Scan on lineitem (cost=0.00..1718935.84 rows=122346 width=19) Filter: ((l_shipmode = ANY ('{"REG AIR",SHIP}'::bpchar[])) AND (l_commitdate < l_receiptdate) AND (l_shipdate < l_commitdate) AND (l_receiptdate >= '1996-01-01'::date) AND (l_receiptdate < '1997-01-01 00:00:00'::timestamp without time zone)) -> Parallel Hash (cost=330879.30..330879.30 rows=6255630 width=24) -> Parallel Seq Scan on orders (cost=0.00..330879.30 rows=6255630 width=24) (14 rows) COMMIT; COMMIT