BEGIN; BEGIN EXPLAIN (ANALYZE, BUFFERS) select l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority from customer, orders, lineitem where c_mktsegment = 'FURNITURE' and c_custkey = o_custkey and l_orderkey = o_orderkey and o_orderdate < date '1995-03-26' and l_shipdate > date '1995-03-26' group by l_orderkey, o_orderdate, o_shippriority order by revenue desc, o_orderdate LIMIT 10; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=2748786.16..2748786.19 rows=10 width=20) (actual time=75156.506..75156.511 rows=10 loops=1) Buffers: shared hit=1059405 read=299663 dirtied=1 written=6 -> Sort (cost=2748786.16..2756739.99 rows=3181531 width=20) (actual time=75156.502..75156.504 rows=10 loops=1) Sort Key: (sum((lineitem.l_extendedprice * (1::double precision - lineitem.l_discount)))), orders.o_orderdate Sort Method: top-N heapsort Memory: 25kB Buffers: shared hit=1059405 read=299663 dirtied=1 written=6 -> HashAggregate (cost=2648219.11..2680034.42 rows=3181531 width=20) (actual time=75056.127..75135.056 rows=113328 loops=1) Buffers: shared hit=1059399 read=299663 dirtied=1 written=6 -> Hash Join (cost=627321.29..2600496.15 rows=3181531 width=20) (actual time=26976.583..74600.755 rows=299218 loops=1) Hash Cond: (lineitem.l_orderkey = orders.o_orderkey) Buffers: shared hit=1059399 read=299663 dirtied=1 written=6 -> Seq Scan on lineitem (cost=0.00..1820672.86 rows=32183116 width=12) (actual time=0.028..27439.788 rows=32090603 loops=1) Filter: (l_shipdate > '1995-03-26'::date) Rows Removed by Filter: 27954776 Buffers: shared hit=828585 read=240023 dirtied=1 written=1 -> Hash (cost=608730.03..608730.03 rows=1487301 width=12) (actual time=26974.809..26974.809 rows=1473562 loops=1) Buckets: 262144 Batches: 1 Memory Usage: 63318kB Buffers: shared hit=230814 read=59640 written=5 -> Hash Join (cost=49763.39..608730.03 rows=1487301 width=12) (actual time=1236.819..26116.228 rows=1473562 loops=1) Hash Cond: (orders.o_custkey = customer.c_custkey) Buffers: shared hit=230814 read=59640 written=5 -> Seq Scan on orders (cost=0.00..442089.90 rows=7418453 width=16) (actual time=0.013..7029.708 rows=7365567 loops=1) Filter: (o_orderdate < '1995-03-26'::date) Rows Removed by Filter: 7649433 Buffers: shared hit=228796 read=25232 written=5 -> Hash (cost=46004.26..46004.26 rows=300730 width=4) (actual time=1236.631..1236.631 rows=299496 loops=1) Buckets: 32768 Batches: 1 Memory Usage: 10530kB Buffers: shared hit=2018 read=34408 -> Bitmap Heap Scan on customer (cost=6967.14..46004.26 rows=300730 width=4) (actual time=127.827..1076.302 rows=299496 loops=1) Recheck Cond: (c_mktsegment = 'FURNITURE'::bpchar) Buffers: shared hit=2018 read=34408 -> Bitmap Index Scan on customer_c_mktsegment_c_custkey_idx (cost=0.00..6891.96 rows=300730 width=0) (actual time=113.565..113.565 rows=299496 loops=1) Index Cond: (c_mktsegment = 'FURNITURE'::bpchar) Buffers: shared read=1151 Total runtime: 75187.699 ms (35 rows) COMMIT; COMMIT