BEGIN; BEGIN EXPLAIN (ANALYZE, BUFFERS) select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= date '1997-01-01' and l_shipdate < cast(date '1997-01-01' + interval '1 year' as date) and l_discount between 0.04 - 0.01 and 0.04 + 0.01 and l_quantity < 25; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1476192.20..1476192.21 rows=1 width=8) (actual time=19596.743..19596.743 rows=1 loops=1) Buffers: shared hit=473562 read=560624 dirtied=201 written=1355 -> Bitmap Heap Scan on lineitem (cost=193600.42..1474180.83 rows=402274 width=8) (actual time=6659.283..19498.433 rows=397336 loops=1) Recheck Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-01-01'::date)) Filter: ((l_discount >= 0.03::double precision) AND (l_discount <= 0.05::double precision) AND (l_quantity < 25::double precision)) Rows Removed by Filter: 8705038 Heap Blocks: exact=1009313 Buffers: shared hit=473562 read=560624 dirtied=201 written=1355 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..193499.86 rows=9259129 width=0) (actual time=6004.178..6004.178 rows=9164522 loops=1) Index Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-01-01'::date)) Buffers: shared hit=1469 read=23404 written=1150 Planning time: 1.879 ms Execution time: 19600.505 ms (13 rows) COMMIT; COMMIT