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-25' and l_shipdate > date '1995-03-25' group by l_orderkey, o_orderdate, o_shippriority order by revenue desc, o_orderdate LIMIT 10; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=2741547.02..2741547.05 rows=10 width=20) (actual time=43585.580..43585.585 rows=10 loops=1) Buffers: shared hit=838725 read=517704 -> Sort (cost=2741547.02..2749426.95 rows=3151970 width=20) (actual time=43585.564..43585.567 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=838725 read=517704 -> HashAggregate (cost=2641914.38..2673434.08 rows=3151970 width=20) (actual time=43508.886..43567.134 rows=113318 loops=1) Buffers: shared hit=838719 read=517704 -> Hash Join (cost=625483.63..2594634.83 rows=3151970 width=20) (actual time=10441.013..43269.801 rows=299180 loops=1) Hash Cond: (lineitem.l_orderkey = orders.o_orderkey) Buffers: shared hit=838719 read=517704 -> Seq Scan on lineitem (cost=0.00..1817039.80 rows=32157787 width=12) (actual time=0.036..17730.932 rows=32116126 loops=1) Filter: (l_shipdate > '1995-03-25'::date) Rows Removed by Filter: 27929543 Buffers: shared hit=549922 read=516553 -> Hash (cost=607087.32..607087.32 rows=1471705 width=12) (actual time=10438.135..10438.135 rows=1472374 loops=1) Buckets: 262144 Batches: 1 Memory Usage: 63267kB Buffers: shared hit=288797 read=1151 -> Hash Join (cost=49686.99..607087.32 rows=1471705 width=12) (actual time=406.935..9973.109 rows=1472374 loops=1) Hash Cond: (orders.o_custkey = customer.c_custkey) Buffers: shared hit=288797 read=1151 -> Seq Scan on orders (cost=0.00..441209.30 rows=7379926 width=16) (actual time=0.021..4282.584 rows=7359337 loops=1) Filter: (o_orderdate < '1995-03-25'::date) Rows Removed by Filter: 7655663 Buffers: shared hit=253522 -> Hash (cost=45947.86..45947.86 rows=299130 width=4) (actual time=406.672..406.672 rows=299496 loops=1) Buckets: 32768 Batches: 1 Memory Usage: 10530kB Buffers: shared hit=35275 read=1151 -> Bitmap Heap Scan on customer (cost=6930.74..45947.86 rows=299130 width=4) (actual time=68.097..337.870 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..6855.96 rows=299130 width=0) (actual time=59.613..59.613 rows=299496 loops=1) Index Cond: (c_mktsegment = 'FURNITURE'::bpchar) Buffers: shared read=1151 Total runtime: 43623.276 ms (35 rows) COMMIT; COMMIT