BEGIN; BEGIN EXPLAIN (ANALYZE, BUFFERS) select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= date '1994-01-01' and l_shipdate < cast(date '1994-01-01' + interval '1 year' as date) and l_discount between 0.05 - 0.01 and 0.05 + 0.01 and l_quantity < 24; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1483441.92..1483441.93 rows=1 width=8) (actual time=40186.417..40186.417 rows=1 loops=1) Buffers: shared hit=872548 read=169371 written=9 -> Bitmap Heap Scan on lineitem (cost=191977.47..1479578.80 rows=772624 width=8) (actual time=10809.258..39850.890 rows=760499 loops=1) Recheck Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01'::date)) Filter: ((l_discount >= 0.04::double precision) AND (l_discount <= 0.06::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8347212 Buffers: shared hit=872548 read=169371 written=9 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..191784.31 rows=9212548 width=0) (actual time=10147.546..10147.546 rows=9226270 loops=1) Index Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01'::date)) Buffers: shared hit=2411 read=22455 Total runtime: 40198.345 ms (11 rows) COMMIT; COMMIT