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-19' and l_shipdate > date '1995-03-19' group by l_orderkey, o_orderdate, o_shippriority order by revenue desc, o_orderdate LIMIT 10; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=2764023.16..2764023.18 rows=10 width=20) (actual time=64406.147..64406.152 rows=10 loops=1) Buffers: shared hit=611672 read=756607 dirtied=253 written=10180 -> Sort (cost=2764023.16..2771935.21 rows=3164819 width=20) (actual time=64406.144..64406.146 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=611672 read=756607 dirtied=253 written=10180 -> HashAggregate (cost=2663984.37..2695632.56 rows=3164819 width=20) (actual time=64272.554..64370.871 rows=113360 loops=1) Buffers: shared hit=611666 read=756607 dirtied=253 written=10180 -> Hash Join (cost=629423.09..2616512.08 rows=3164819 width=20) (actual time=22525.705..63910.660 rows=298841 loops=1) Hash Cond: (lineitem.l_orderkey = orders.o_orderkey) Buffers: shared hit=611666 read=756607 dirtied=253 written=10180 -> Seq Scan on lineitem (cost=0.00..1833355.58 rows=32556061 width=12) (actual time=0.037..21712.454 rows=32263531 loops=1) Filter: (l_shipdate > '1995-03-19'::date) Rows Removed by Filter: 27780645 Buffers: shared hit=341020 read=735026 dirtied=1 written=1 -> Hash (cost=611013.74..611013.74 rows=1472748 width=12) (actual time=22523.842..22523.842 rows=1464869 loops=1) Buckets: 262144 Batches: 1 Memory Usage: 62944kB Buffers: shared hit=270646 read=21581 dirtied=252 written=10179 -> Hash Join (cost=49708.91..611013.74 rows=1472748 width=12) (actual time=709.099..21859.465 rows=1464869 loops=1) Hash Cond: (orders.o_custkey = customer.c_custkey) Buffers: shared hit=270646 read=21581 dirtied=252 written=10179 -> Seq Scan on orders (cost=0.00..445175.49 rows=7374681 width=16) (actual time=0.012..5301.181 rows=7322352 loops=1) Filter: (o_orderdate < '1995-03-19'::date) Rows Removed by Filter: 7692648 Buffers: shared hit=255391 read=410 dirtied=252 written=95 -> Hash (cost=45964.47..45964.47 rows=299555 width=4) (actual time=708.899..708.899 rows=299496 loops=1) Buckets: 32768 Batches: 1 Memory Usage: 10530kB Buffers: shared hit=15255 read=21171 written=10084 -> Bitmap Heap Scan on customer (cost=6942.03..45964.47 rows=299555 width=4) (actual time=78.094..605.794 rows=299496 loops=1) Recheck Cond: (c_mktsegment = 'FURNITURE'::bpchar) Buffers: shared hit=15255 read=21171 written=10084 -> Bitmap Index Scan on customer_c_mktsegment_c_custkey_idx (cost=0.00..6867.14 rows=299555 width=0) (actual time=68.910..68.910 rows=299496 loops=1) Index Cond: (c_mktsegment = 'FURNITURE'::bpchar) Buffers: shared read=1151 written=389 Total runtime: 64444.909 ms (35 rows) COMMIT; COMMIT