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 ('SHIP', 'FOB') and l_commitdate < l_receiptdate and l_shipdate < l_commitdate and l_receiptdate >= date '1997-01-01' and l_receiptdate < date '1997-01-01' + interval '1 year' group by l_shipmode order by l_shipmode; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (cost=2216907.62..2219288.98 rows=7 width=27) Group Key: lineitem.l_shipmode -> Gather Merge (cost=2216907.62..2219288.81 rows=14 width=27) Workers Planned: 2 -> Partial GroupAggregate (cost=2215907.60..2218287.17 rows=7 width=27) Group Key: lineitem.l_shipmode -> Sort (cost=2215907.60..2216205.04 rows=118975 width=27) Sort Key: lineitem.l_shipmode -> Parallel Hash Join (cost=445729.68..2203028.83 rows=118975 width=27) Hash Cond: (lineitem.l_orderkey = orders.o_orderkey) -> Parallel Seq Scan on lineitem (cost=0.00..1718935.84 rows=118975 width=19) Filter: ((l_shipmode = ANY ('{SHIP,FOB}'::bpchar[])) AND (l_commitdate < l_receiptdate) AND (l_shipdate < l_commitdate) AND (l_receiptdate >= '1997-01-01'::date) AND (l_receiptdate < '1998-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