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=1469379.77..1469379.78 rows=1 width=8) (actual time=16365.508..16365.509 rows=1 loops=1) Buffers: shared hit=391579 read=640154 written=3662 -> Bitmap Heap Scan on lineitem (cost=190801.32..1465393.59 rows=797236 width=8) (actual time=4567.894..16199.533 rows=794114 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: 8308186 Heap Blocks: exact=1006860 Buffers: shared hit=391579 read=640154 written=3662 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..190602.02 rows=9108945 width=0) (actual time=4088.019..4088.019 rows=9138690 loops=1) Index Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-01-01'::date)) Buffers: shared hit=2033 read=22840 written=2106 Planning time: 1.825 ms Execution time: 16378.119 ms (13 rows) COMMIT; COMMIT