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 '1994-08-01' and l_shipdate < cast(date '1994-08-01' + interval '1 month' as date); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1172710.79..1172710.80 rows=1 width=29) (actual time=11757.229..11757.230 rows=1 loops=1) Buffers: shared hit=159209 read=298801 dirtied=32 written=12285 -> Hash Join (cost=101692.97..1159332.00 rows=764502 width=29) (actual time=2296.144..11275.712 rows=774032 loops=1) Hash Cond: (lineitem.l_partkey = part.p_partkey) Buffers: shared hit=159209 read=298801 dirtied=32 written=12285 -> Bitmap Heap Scan on lineitem (cost=16170.97..1056608.71 rows=764502 width=12) (actual time=650.750..6704.579 rows=774032 loops=1) Recheck Cond: ((l_shipdate >= '1994-08-01'::date) AND (l_shipdate < '1994-09-01'::date)) Buffers: shared hit=155994 read=261491 dirtied=32 written=12197 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..15979.85 rows=764502 width=0) (actual time=403.255..403.255 rows=779409 loops=1) Index Cond: ((l_shipdate >= '1994-08-01'::date) AND (l_shipdate < '1994-09-01'::date)) Buffers: shared read=2120 -> Hash (cost=60522.00..60522.00 rows=2000000 width=25) (actual time=1643.545..1643.545 rows=2000000 loops=1) Buckets: 262144 Batches: 1 Memory Usage: 115519kB Buffers: shared hit=3212 read=37310 written=88 -> Seq Scan on part (cost=0.00..60522.00 rows=2000000 width=25) (actual time=0.011..944.030 rows=2000000 loops=1) Buffers: shared hit=3212 read=37310 written=88 Total runtime: 11772.753 ms (17 rows) COMMIT; COMMIT