BEGIN; BEGIN EXPLAIN (ANALYZE, BUFFERS) select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= date '1994-01-01' and l_shipdate < cast(date '1994-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=1479553.75..1479553.76 rows=1 width=8) (actual time=72993.377..72993.377 rows=1 loops=1) Buffers: shared hit=472143 read=566771 written=72 -> Bitmap Heap Scan on lineitem (cost=191804.96..1475703.60 rows=770030 width=8) (actual time=10172.508..72583.585 rows=761522 loops=1) Recheck Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01'::date)) Filter: ((l_discount >= 0.01::double precision) AND (l_discount <= 0.03::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8346344 Buffers: shared hit=472143 read=566771 written=72 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..191612.45 rows=9190162 width=0) (actual time=9467.775..9467.775 rows=9199294 loops=1) Index Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01'::date)) Buffers: shared read=24866 written=1 Total runtime: 73002.305 ms (11 rows) COMMIT; COMMIT