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 ('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; NOTICE: duration: 19349.563 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 ('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; Finalize GroupAggregate (cost=2223976.88..2226432.98 rows=7 width=27) (actual time=19072.778..19349.543 rows=2 loops=1) Group Key: lineitem.l_shipmode -> Gather Merge (cost=2223976.88..2226432.80 rows=14 width=27) (actual time=19030.041..19349.525 rows=6 loops=1) Workers Planned: 2 Workers Launched: 2 -> Partial GroupAggregate (cost=2222976.85..2225431.16 rows=7 width=27) (actual time=19016.613..19057.644 rows=2 loops=3) Group Key: lineitem.l_shipmode -> Sort (cost=2222976.85..2223283.63 rows=122712 width=27) (actual time=18974.490..19000.163 rows=104426 loops=3) Sort Key: lineitem.l_shipmode Sort Method: external merge Disk: 3864kB Worker 0: Sort Method: external merge Disk: 3872kB Worker 1: Sort Method: external merge Disk: 3656kB -> Parallel Hash Join (cost=447062.90..2209668.17 rows=122712 width=27) (actual time=18027.515..18913.513 rows=104426 loops=3) Hash Cond: (lineitem.l_orderkey = orders.o_orderkey) -> Parallel Seq Scan on lineitem (cost=0.00..1724079.15 rows=122712 width=19) (actual time=0.096..13908.345 rows=104426 loops=3) 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)) Rows Removed by Filter: 19890834 -> Parallel Hash (cost=331869.51..331869.51 rows=6274351 width=24) (actual time=3902.634..3902.635 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.079..1672.696 rows=5000000 loops=3) l_shipmode | high_line_count | low_line_count ------------+-----------------+---------------- REG AIR | 62747 | 94451 SHIP | 62226 | 93855 (2 rows) COMMIT; COMMIT