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-16' and l_shipdate > date '1995-03-16' group by l_orderkey, o_orderdate, o_shippriority order by revenue desc, o_orderdate LIMIT 10; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=2740610.78..2740610.80 rows=10 width=20) (actual time=83463.179..83463.183 rows=10 loops=1) Buffers: shared hit=682169 read=675584 dirtied=298 written=64 -> Sort (cost=2740610.78..2748391.73 rows=3112382 width=20) (actual time=83463.175..83463.176 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=682169 read=675584 dirtied=298 written=64 -> HashAggregate (cost=2642229.50..2673353.32 rows=3112382 width=20) (actual time=83372.861..83441.875 rows=113477 loops=1) Buffers: shared hit=682163 read=675584 dirtied=298 written=64 -> Hash Join (cost=624246.18..2595543.77 rows=3112382 width=20) (actual time=31028.825..82845.354 rows=299069 loops=1) Hash Cond: (lineitem.l_orderkey = orders.o_orderkey) Buffers: shared hit=682163 read=675584 dirtied=298 written=64 -> Seq Scan on lineitem (cost=0.00..1818868.26 rows=32348136 width=12) (actual time=0.063..28747.870 rows=32340889 loops=1) Filter: (l_shipdate > '1995-03-16'::date) Rows Removed by Filter: 27704714 Buffers: shared hit=576268 read=491278 dirtied=46 written=46 -> Hash (cost=606169.79..606169.79 rows=1446111 width=12) (actual time=31026.711..31026.711 rows=1461146 loops=1) Buckets: 262144 Batches: 1 Memory Usage: 62784kB Buffers: shared hit=105895 read=184306 dirtied=252 written=18 -> Hash Join (cost=49575.50..606169.79 rows=1446111 width=12) (actual time=1931.326..29612.583 rows=1461146 loops=1) Hash Cond: (orders.o_custkey = customer.c_custkey) Buffers: shared hit=105895 read=184306 dirtied=252 written=18 -> Seq Scan on orders (cost=0.00..441649.60 rows=7307897 width=16) (actual time=0.014..8460.239 rows=7303203 loops=1) Filter: (o_orderdate < '1995-03-16'::date) Rows Removed by Filter: 7711797 Buffers: shared hit=70620 read=183155 dirtied=252 written=18 -> Hash (cost=45865.19..45865.19 rows=296825 width=4) (actual time=1931.130..1931.130 rows=299496 loops=1) Buckets: 32768 Batches: 1 Memory Usage: 10530kB Buffers: shared hit=35275 read=1151 -> Bitmap Heap Scan on customer (cost=6876.87..45865.19 rows=296825 width=4) (actual time=191.911..643.636 rows=299496 loops=1) Recheck Cond: (c_mktsegment = 'FURNITURE'::bpchar) Buffers: shared hit=35275 read=1151 -> Bitmap Index Scan on customer_c_mktsegment_c_custkey_idx (cost=0.00..6802.67 rows=296825 width=0) (actual time=175.779..175.779 rows=299496 loops=1) Index Cond: (c_mktsegment = 'FURNITURE'::bpchar) Buffers: shared read=1151 Total runtime: 83527.086 ms (35 rows) COMMIT; COMMIT