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=1372864.72..1372864.73 rows=1 width=8) (actual time=19525.025..19525.025 rows=1 loops=1) Buffers: shared hit=1068855 read=626 -> Bitmap Heap Scan on lineitem (cost=92415.44..1369017.35 rows=769474 width=8) (actual time=120.808..19353.478 rows=764693 loops=1) Recheck Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Rows Removed by Index Recheck: 50862218 Filter: ((l_discount >= 0.01::double precision) AND (l_discount <= 0.03::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8358742 Heap Blocks: lossy=1069433 Buffers: shared hit=1068855 read=626 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey_brin_idx (cost=0.00..92223.07 rows=9207507 width=0) (actual time=119.975..119.975 rows=10694400 loops=1) Index Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Buffers: shared hit=48 Planning time: 1.359 ms Execution time: 19525.136 ms (14 rows) COMMIT; COMMIT