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=1383929.34..1383929.35 rows=1 width=8) (actual time=23919.122..23919.122 rows=1 loops=1) Buffers: shared hit=572750 read=506558 written=1658 -> Bitmap Heap Scan on lineitem (cost=92749.72..1379911.61 rows=803546 width=8) (actual time=121.003..23673.511 rows=794936 loops=1) Recheck Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Rows Removed by Index Recheck: 50931591 Filter: ((l_discount >= 0.06::double precision) AND (l_discount <= 0.08::double precision) AND (l_quantity < 25::double precision)) Rows Removed by Filter: 8318770 Heap Blocks: lossy=1079260 Buffers: shared hit=572750 read=506558 written=1658 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey_brin_idx (cost=0.00..92548.84 rows=9240084 width=0) (actual time=120.099..120.099 rows=10792960 loops=1) Index Cond: ((l_shipdate >= '1995-01-01'::date) AND (l_shipdate < '1996-01-01'::date)) Buffers: shared hit=12 read=36 Planning time: 2.050 ms Execution time: 23919.267 ms (14 rows) COMMIT; COMMIT