BEGIN; BEGIN EXPLAIN (ANALYZE, BUFFERS) select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= date '1995-01-01' and l_shipdate < cast(date '1995-01-01' + interval '1 year' as date) and l_discount between 0.09 - 0.01 and 0.09 + 0.01 and l_quantity < 24; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1480826.52..1480826.53 rows=1 width=8) (actual time=21910.568..21910.568 rows=1 loops=1) Buffers: shared hit=686288 read=354809 written=423 -> Bitmap Heap Scan on lineitem (cost=192156.33..1478903.45 rows=384613 width=8) (actual time=6524.582..21773.724 rows=380193 loops=1) Recheck Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Filter: ((l_discount >= 0.08::double precision) AND (l_discount <= 0.1::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8733513 Heap Blocks: exact=1016211 Buffers: shared hit=686288 read=354809 written=423 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..192060.17 rows=9221561 width=0) (actual time=5768.769..5768.769 rows=9224450 loops=1) Index Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Buffers: shared read=24886 written=23 Planning time: 3.105 ms Execution time: 21917.441 ms (13 rows) COMMIT; COMMIT