BEGIN; BEGIN EXPLAIN (ANALYZE, BUFFERS) select 100.00 * sum(case when p_type like 'PROMO%' then l_extendedprice * (1 - l_discount) else 0 end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue from lineitem, part where l_partkey = p_partkey and l_shipdate >= date '1993-02-01' and l_shipdate < cast(date '1993-02-01' + interval '1 month' as date); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1148875.63..1148875.65 rows=1 width=29) (actual time=11377.889..11377.889 rows=1 loops=1) Buffers: shared hit=141679 read=296317 -> Hash Join (cost=100493.73..1136451.65 rows=709942 width=29) (actual time=2851.970..10920.295 rows=700490 loops=1) Hash Cond: (lineitem.l_partkey = part.p_partkey) Buffers: shared hit=141679 read=296317 -> Bitmap Heap Scan on lineitem (cost=14971.73..1034955.95 rows=709942 width=12) (actual time=744.328..6379.027 rows=700490 loops=1) Recheck Cond: ((l_shipdate >= '1993-02-01'::date) AND (l_shipdate < '1993-03-01'::date)) Buffers: shared hit=126838 read=270633 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..14794.25 rows=709942 width=0) (actual time=517.959..517.959 rows=708791 loops=1) Index Cond: ((l_shipdate >= '1993-02-01'::date) AND (l_shipdate < '1993-03-01'::date)) Buffers: shared read=1917 -> Hash (cost=60522.00..60522.00 rows=2000000 width=25) (actual time=2105.936..2105.936 rows=2000000 loops=1) Buckets: 262144 Batches: 1 Memory Usage: 115519kB Buffers: shared hit=14838 read=25684 -> Seq Scan on part (cost=0.00..60522.00 rows=2000000 width=25) (actual time=0.012..1099.402 rows=2000000 loops=1) Buffers: shared hit=14838 read=25684 Total runtime: 11397.443 ms (17 rows) COMMIT; COMMIT