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.02 - 0.01 and 0.02 + 0.01 and l_quantity < 24; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1480544.56..1480544.57 rows=1 width=8) (actual time=19820.131..19820.132 rows=1 loops=1) Buffers: shared hit=592466 read=447323 written=879 -> Bitmap Heap Scan on lineitem (cost=191713.76..1476696.53 rows=769605 width=8) (actual time=5613.945..19629.066 rows=762948 loops=1) Recheck Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-01-01'::date)) Filter: ((l_discount >= 0.01::double precision) AND (l_discount <= 0.03::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8340752 Heap Blocks: exact=1014916 Buffers: shared hit=592466 read=447323 written=879 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..191521.36 rows=9190879 width=0) (actual time=5056.327..5056.327 rows=9212081 loops=1) Index Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-01-01'::date)) Buffers: shared hit=124 read=24749 written=344 Planning time: 2.062 ms Execution time: 19827.499 ms (13 rows) COMMIT; COMMIT