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.08 - 0.01 and 0.08 + 0.01 and l_quantity < 25; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1485206.49..1485206.50 rows=1 width=8) (actual time=55703.722..55703.723 rows=1 loops=1) Buffers: shared hit=944133 read=99781 dirtied=48 written=2360 -> Bitmap Heap Scan on lineitem (cost=191740.96..1481176.38 rows=806022 width=8) (actual time=12827.635..55351.224 rows=794166 loops=1) Recheck Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Filter: ((l_discount >= 0.07::double precision) AND (l_discount <= 0.09::double precision) AND (l_quantity < 25::double precision)) Rows Removed by Filter: 8310523 Buffers: shared hit=944133 read=99781 dirtied=48 written=2360 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..191539.46 rows=9209263 width=0) (actual time=10632.892..10632.892 rows=9250877 loops=1) Index Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Buffers: shared hit=6791 read=18096 written=867 Total runtime: 55715.630 ms (11 rows) COMMIT; COMMIT