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.09 - 0.01 and 0.09 + 0.01 and l_quantity < 24; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1365034.42..1365034.43 rows=1 width=8) (actual time=28645.012..28645.012 rows=1 loops=1) Buffers: shared hit=594696 read=472895 written=7774 -> Bitmap Heap Scan on lineitem (cost=91119.35..1363134.12 rows=380061 width=8) (actual time=119.378..28491.822 rows=380602 loops=1) Recheck Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01'::date)) Rows Removed by Index Recheck: 50937553 Filter: ((l_discount >= 0.08::double precision) AND (l_discount <= 0.1::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8727448 Heap Blocks: lossy=1067543 Buffers: shared hit=594696 read=472895 written=7774 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey_brin_idx (cost=0.00..91024.34 rows=9087634 width=0) (actual time=118.583..118.583 rows=10676480 loops=1) Index Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01'::date)) Buffers: shared hit=48 Planning time: 1.320 ms Execution time: 28645.123 ms (14 rows) COMMIT; COMMIT