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-04' and l_shipdate > date '1995-03-04' group by l_orderkey, o_orderdate, o_shippriority order by revenue desc, o_orderdate LIMIT 10; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=2770082.45..2770082.47 rows=10 width=20) (actual time=78513.845..78513.850 rows=10 loops=1) Buffers: shared hit=953575 read=417352 written=5 -> Sort (cost=2770082.45..2778040.35 rows=3183160 width=20) (actual time=78513.841..78513.844 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=953575 read=417352 written=5 -> HashAggregate (cost=2669463.90..2701295.50 rows=3183160 width=20) (actual time=78402.347..78489.998 rows=113532 loops=1) Buffers: shared hit=953569 read=417352 written=5 -> Hash Join (cost=629187.56..2621716.50 rows=3183160 width=20) (actual time=26615.417..77926.999 rows=299128 loops=1) Hash Cond: (lineitem.l_orderkey = orders.o_orderkey) Buffers: shared hit=953569 read=417352 written=5 -> Seq Scan on lineitem (cost=0.00..1836999.43 rows=32986112 width=12) (actual time=0.042..27796.487 rows=32640011 loops=1) Filter: (l_shipdate > '1995-03-04'::date) Rows Removed by Filter: 27404983 Buffers: shared hit=662371 read=415817 written=5 -> Hash (cost=610876.77..610876.77 rows=1464863 width=12) (actual time=26613.306..26613.306 rows=1446148 loops=1) Buckets: 262144 Batches: 1 Memory Usage: 62140kB Buffers: shared hit=291198 read=1535 -> Hash Join (cost=49773.94..610876.77 rows=1464863 width=12) (actual time=733.068..24991.777 rows=1446148 loops=1) Hash Cond: (orders.o_custkey = customer.c_custkey) Buffers: shared hit=291198 read=1535 -> Seq Scan on orders (cost=0.00..446056.09 rows=7301681 width=16) (actual time=0.016..6700.970 rows=7228039 loops=1) Filter: (o_orderdate < '1995-03-04'::date) Rows Removed by Filter: 7786961 Buffers: shared hit=255998 read=309 -> Hash (cost=46012.31..46012.31 rows=300930 width=4) (actual time=732.833..732.833 rows=299496 loops=1) Buckets: 32768 Batches: 1 Memory Usage: 10530kB Buffers: shared hit=35200 read=1226 -> Bitmap Heap Scan on customer (cost=6972.69..46012.31 rows=300930 width=4) (actual time=107.408..600.056 rows=299496 loops=1) Recheck Cond: (c_mktsegment = 'FURNITURE'::bpchar) Buffers: shared hit=35200 read=1226 -> Bitmap Index Scan on customer_c_mktsegment_c_custkey_idx (cost=0.00..6897.46 rows=300930 width=0) (actual time=95.163..95.163 rows=299496 loops=1) Index Cond: (c_mktsegment = 'FURNITURE'::bpchar) Buffers: shared read=1151 Total runtime: 78561.109 ms (35 rows) COMMIT; COMMIT