load 'auto_explain'; LOAD set auto_explain.log_min_duration to 0; SET set auto_explain.log_analyze to on; SET set auto_explain.log_wal to on; SET set auto_explain.log_timing to on; SET set auto_explain.log_level to notice; SET BEGIN; BEGIN 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 ('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; NOTICE: duration: 21098.217 ms plan: Query Text: 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 ('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; Finalize GroupAggregate (cost=2223642.12..2226046.62 rows=7 width=27) (actual time=20673.616..21098.198 rows=2 loops=1) Group Key: lineitem.l_shipmode -> Gather Merge (cost=2223642.12..2226046.44 rows=14 width=27) (actual time=20608.955..21098.180 rows=6 loops=1) Workers Planned: 2 Workers Launched: 2 -> Partial GroupAggregate (cost=2222642.09..2225044.80 rows=7 width=27) (actual time=20571.151..20630.952 rows=2 loops=3) Group Key: lineitem.l_shipmode -> Sort (cost=2222642.09..2222942.42 rows=120132 width=27) (actual time=20485.030..20525.112 rows=104150 loops=3) Sort Key: lineitem.l_shipmode Sort Method: external merge Disk: 3576kB Worker 0: Sort Method: external merge Disk: 4120kB Worker 1: Sort Method: external merge Disk: 3664kB -> Parallel Hash Join (cost=447062.90..2209629.40 rows=120132 width=27) (actual time=18893.932..20399.170 rows=104150 loops=3) Hash Cond: (lineitem.l_orderkey = orders.o_orderkey) -> Parallel Seq Scan on lineitem (cost=0.00..1724079.15 rows=120132 width=19) (actual time=0.136..13864.453 rows=104150 loops=3) Filter: ((l_shipmode = ANY ('{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)) Rows Removed by Filter: 19891111 -> Parallel Hash (cost=331869.51..331869.51 rows=6274351 width=24) (actual time=4793.292..4793.293 rows=5000000 loops=3) Buckets: 65536 Batches: 256 Memory Usage: 3808kB -> Parallel Seq Scan on orders (cost=0.00..331869.51 rows=6274351 width=24) (actual time=0.043..2062.869 rows=5000000 loops=3) l_shipmode | high_line_count | low_line_count ------------+-----------------+---------------- AIR | 62347 | 94021 SHIP | 62226 | 93855 (2 rows) COMMIT; COMMIT