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.06 - 0.01 and 0.06 + 0.01 and l_quantity < 25; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1478645.79..1478645.80 rows=1 width=8) (actual time=20496.801..20496.801 rows=1 loops=1) Buffers: shared hit=500895 read=534356 written=398 -> Bitmap Heap Scan on lineitem (cost=193525.51..1474582.51 rows=812656 width=8) (actual time=6875.167..20320.116 rows=795809 loops=1) Recheck Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Filter: ((l_discount >= 0.05::double precision) AND (l_discount <= 0.07::double precision) AND (l_quantity < 25::double precision)) Rows Removed by Filter: 8327524 Heap Blocks: exact=1010319 Buffers: shared hit=500895 read=534356 written=398 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..193322.35 rows=9253378 width=0) (actual time=6103.723..6103.723 rows=9186518 loops=1) Index Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Buffers: shared hit=87 read=24845 written=210 Planning time: 2.891 ms Execution time: 20500.867 ms (13 rows) COMMIT; COMMIT