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.07 - 0.01 and 0.07 + 0.01 and l_quantity < 25; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1373001.51..1373001.52 rows=1 width=8) (actual time=24406.337..24406.337 rows=1 loops=1) Buffers: shared hit=556128 read=514657 dirtied=1321 written=6702 -> Bitmap Heap Scan on lineitem (cost=92018.44..1369015.51 rows=797200 width=8) (actual time=120.227..24167.103 rows=794275 loops=1) Recheck Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Rows Removed by Index Recheck: 50880208 Filter: ((l_discount >= 0.06::double precision) AND (l_discount <= 0.08::double precision) AND (l_quantity < 25::double precision)) Rows Removed by Filter: 8311825 Heap Blocks: lossy=1070737 Buffers: shared hit=556128 read=514657 dirtied=1321 written=6702 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey_brin_idx (cost=0.00..91819.14 rows=9167114 width=0) (actual time=119.336..119.336 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 Planning time: 1.465 ms Execution time: 24406.450 ms (14 rows) COMMIT; COMMIT