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 ('TRUCK', 'FOB') 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=2214858.90..2217261.46 rows=7 width=27) Group Key: lineitem.l_shipmode -> Gather Merge (cost=2214858.90..2217261.29 rows=14 width=27) Workers Planned: 2 -> Partial GroupAggregate (cost=2213858.88..2216259.65 rows=7 width=27) Group Key: lineitem.l_shipmode -> Sort (cost=2213858.88..2214158.96 rows=120035 width=27) Sort Key: lineitem.l_shipmode -> Parallel Hash Join (cost=445287.15..2200858.57 rows=120035 width=27) Hash Cond: (lineitem.l_orderkey = orders.o_orderkey) -> Parallel Seq Scan on lineitem (cost=0.00..1717230.32 rows=120035 width=19) Filter: ((l_shipmode = ANY ('{TRUCK,FOB}'::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=330551.29..330551.29 rows=6249429 width=24) -> Parallel Seq Scan on orders (cost=0.00..330551.29 rows=6249429 width=24) (14 rows) COMMIT; COMMIT