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.07 - 0.01 and 0.07 + 0.01 and l_quantity < 25; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1468459.21..1468459.22 rows=1 width=8) (actual time=16496.873..16496.874 rows=1 loops=1) Buffers: shared hit=555376 read=475381 written=83 -> Bitmap Heap Scan on lineitem (cost=190904.20..1464469.54 rows=797935 width=8) (actual time=4567.385..16319.047 rows=794843 loops=1) Recheck Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-01-01'::date)) Filter: ((l_discount >= 0.06::double precision) AND (l_discount <= 0.08::double precision) AND (l_quantity < 25::double precision)) Rows Removed by Filter: 8316257 Heap Blocks: exact=1005884 Buffers: shared hit=555376 read=475381 written=83 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..190704.72 rows=9109215 width=0) (actual time=4130.825..4130.825 rows=9129496 loops=1) Index Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-01-01'::date)) Buffers: shared hit=3 read=24870 written=39 Planning time: 2.658 ms Execution time: 16500.702 ms (13 rows) COMMIT; COMMIT