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.03 - 0.01 and 0.03 + 0.01 and l_quantity < 24; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1470014.37..1470014.38 rows=1 width=8) (actual time=27274.228..27274.228 rows=1 loops=1) Buffers: shared hit=731655 read=300425 written=802 -> Bitmap Heap Scan on lineitem (cost=191174.36..1466194.57 rows=763959 width=8) (actual time=8195.595..26942.299 rows=762635 loops=1) Recheck Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Filter: ((l_discount >= 0.02::double precision) AND (l_discount <= 0.04::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8352749 Buffers: shared hit=731655 read=300425 written=802 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..190983.37 rows=9126854 width=0) (actual time=7474.574..7474.574 rows=9142993 loops=1) Index Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Buffers: shared hit=240 read=24647 written=658 Total runtime: 27280.727 ms (11 rows) COMMIT; COMMIT