BEGIN; BEGIN EXPLAIN (ANALYZE, BUFFERS) select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= date '1995-01-01' and l_shipdate < cast(date '1995-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=1372838.22..1372838.23 rows=1 width=8) (actual time=24957.464..24957.464 rows=1 loops=1) Buffers: shared hit=524559 read=546226 written=1859 -> Bitmap Heap Scan on lineitem (cost=92010.66..1369007.73 rows=766098 width=8) (actual time=121.474..24714.951 rows=761246 loops=1) Recheck Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Rows Removed by Index Recheck: 50930978 Filter: ((l_discount >= 0.01::double precision) AND (l_discount <= 0.03::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8353997 Heap Blocks: lossy=1070737 Buffers: shared hit=524559 read=546226 written=1859 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey_brin_idx (cost=0.00..91819.14 rows=9167114 width=0) (actual time=120.632..120.632 rows=10708480 loops=1) Index Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Buffers: shared hit=13 read=35 written=7 Planning time: 1.444 ms Execution time: 24957.576 ms (14 rows) COMMIT; COMMIT