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.08 - 0.01 and 0.08 + 0.01 and l_quantity < 25; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1476340.56..1476340.57 rows=1 width=8) (actual time=47855.513..47855.513 rows=1 loops=1) Buffers: shared hit=556454 read=477798 written=52 -> Bitmap Heap Scan on lineitem (cost=193001.05..1472324.20 rows=803273 width=8) (actual time=8735.933..47508.818 rows=795848 loops=1) Recheck Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Filter: ((l_discount >= 0.07::double precision) AND (l_discount <= 0.09::double precision) AND (l_quantity < 25::double precision)) Rows Removed by Filter: 8336616 Buffers: shared hit=556454 read=477798 written=52 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..192800.23 rows=9223340 width=0) (actual time=8094.919..8094.919 rows=9177397 loops=1) Index Cond: ((l_shipdate >= '1996-01-01'::date) AND (l_shipdate < '1997-01-01'::date)) Buffers: shared read=24933 Total runtime: 47863.229 ms (11 rows) COMMIT; COMMIT