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 < 24; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1468510.61..1468510.62 rows=1 width=8) (actual time=18024.230..18024.230 rows=1 loops=1) Buffers: shared hit=787534 read=242720 written=4 -> Bitmap Heap Scan on lineitem (cost=191564.73..1464681.31 rows=765861 width=8) (actual time=7385.800..17873.367 rows=765425 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 < 24::double precision)) Rows Removed by Filter: 8367003 Heap Blocks: exact=1005322 Buffers: shared hit=787534 read=242720 written=4 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..191373.27 rows=9136470 width=0) (actual time=6687.341..6687.341 rows=9141400 loops=1) Index Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Buffers: shared hit=2113 read=22819 Planning time: 1.884 ms Execution time: 18036.605 ms (13 rows) COMMIT; COMMIT