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.05 - 0.01 and 0.05 + 0.01 and l_quantity < 24; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1385481.35..1385481.36 rows=1 width=8) (actual time=25586.864..25586.864 rows=1 loops=1) Buffers: shared hit=641696 read=437612 written=300 -> Bitmap Heap Scan on lineitem (cost=93263.41..1381596.00 rows=777070 width=8) (actual time=126.049..25344.913 rows=762955 loops=1) Recheck Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Rows Removed by Index Recheck: 50861951 Filter: ((l_discount >= 0.04::double precision) AND (l_discount <= 0.06::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8360632 Heap Blocks: lossy=1079260 Buffers: shared hit=641696 read=437612 written=300 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey_brin_idx (cost=0.00..93069.15 rows=9292115 width=0) (actual time=125.126..125.126 rows=10792960 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.460 ms Execution time: 25586.974 ms (14 rows) COMMIT; COMMIT