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.07 - 0.01 and 0.07 + 0.01 and l_quantity < 24; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1475538.98..1475538.99 rows=1 width=8) (actual time=27827.202..27827.202 rows=1 loops=1) Buffers: shared hit=552424 read=481828 written=572 -> Bitmap Heap Scan on lineitem (cost=192693.34..1471694.50 rows=768897 width=8) (actual time=7630.295..27506.596 rows=762557 loops=1) Recheck Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Filter: ((l_discount >= 0.06::double precision) AND (l_discount <= 0.08::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8369907 Buffers: shared hit=552424 read=481828 written=572 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..192501.12 rows=9209029 width=0) (actual time=6935.281..6935.281 rows=9177397 loops=1) Index Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Buffers: shared hit=24929 read=4 Total runtime: 27841.274 ms (11 rows) COMMIT; COMMIT