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 < 25; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1472297.11..1472297.12 rows=1 width=8) (actual time=19167.972..19167.973 rows=1 loops=1) Buffers: shared hit=726366 read=306896 written=10192 -> Bitmap Heap Scan on lineitem (cost=191614.58..1468286.98 rows=802026 width=8) (actual time=4781.266..18949.451 rows=797721 loops=1) Recheck Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Filter: ((l_discount >= 0.01::double precision) AND (l_discount <= 0.03::double precision) AND (l_quantity < 25::double precision)) Rows Removed by Filter: 8325685 Heap Blocks: exact=1008330 Buffers: shared hit=726366 read=306896 written=10192 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..191414.08 rows=9152551 width=0) (actual time=4206.304..4206.304 rows=9168650 loops=1) Index Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Buffers: shared hit=300 read=24632 written=2 Planning time: 2.386 ms Execution time: 19179.485 ms (13 rows) COMMIT; COMMIT