BEGIN; BEGIN EXPLAIN (ANALYZE, BUFFERS) select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= date '1997-01-01' and l_shipdate < cast(date '1997-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=1476855.02..1476855.03 rows=1 width=8) (actual time=37348.757..37348.757 rows=1 loops=1) Buffers: shared hit=290463 read=743298 dirtied=352 written=23 -> Bitmap Heap Scan on lineitem (cost=193246.56..1472833.55 rows=804294 width=8) (actual time=10797.004..37008.085 rows=794920 loops=1) Recheck Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-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: 8316529 Buffers: shared hit=290463 read=743298 dirtied=352 written=23 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..193045.49 rows=9235066 width=0) (actual time=10072.204..10072.204 rows=9156668 loops=1) Index Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-01-01'::date)) Buffers: shared hit=3 read=24871 written=13 Total runtime: 37364.580 ms (11 rows) COMMIT; COMMIT