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.02 - 0.01 and 0.02 + 0.01 and l_quantity < 24; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1377255.89..1377255.90 rows=1 width=8) (actual time=23441.548..23441.548 rows=1 loops=1) Buffers: shared hit=570512 read=502390 written=168 -> Bitmap Heap Scan on lineitem (cost=92710.59..1373396.22 rows=771935 width=8) (actual time=120.622..23206.810 rows=765308 loops=1) Recheck Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Rows Removed by Index Recheck: 50912856 Filter: ((l_discount >= 0.01::double precision) AND (l_discount <= 0.03::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8367146 Heap Blocks: lossy=1072854 Buffers: shared hit=570512 read=502390 written=168 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey_brin_idx (cost=0.00..92517.61 rows=9236961 width=0) (actual time=119.815..119.815 rows=10728960 loops=1) Index Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Buffers: shared hit=13 read=35 Planning time: 1.565 ms Execution time: 23441.659 ms (14 rows) COMMIT; COMMIT