BEGIN; BEGIN EXPLAIN (ANALYZE, BUFFERS) select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= date '1996-01-01' and l_shipdate < cast(date '1996-01-01' + interval '1 year' as date) and l_discount between 0.02 - 0.01 and 0.02 + 0.01 and l_quantity < 25; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1470843.62..1470843.63 rows=1 width=8) (actual time=24145.172..24145.173 rows=1 loops=1) Buffers: shared hit=379197 read=653010 written=415 -> Bitmap Heap Scan on lineitem (cost=191517.44..1466837.74 rows=801176 width=8) (actual time=9515.669..23966.806 rows=797807 loops=1) Recheck Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Filter: ((l_discount >= 0.01::double precision) AND (l_discount <= 0.03::double precision) AND (l_quantity < 25::double precision)) Rows Removed by Filter: 8325628 Heap Blocks: exact=1007275 Buffers: shared hit=379197 read=653010 written=415 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..191317.15 rows=9142858 width=0) (actual time=8732.538..8732.538 rows=9159291 loops=1) Index Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Buffers: shared hit=483 read=24449 written=414 Planning time: 1.788 ms Execution time: 24159.265 ms (13 rows) COMMIT; COMMIT