BEGIN; BEGIN EXPLAIN (ANALYZE, BUFFERS) select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= date '1997-01-01' and l_shipdate < cast(date '1997-01-01' + interval '1 year' as date) and l_discount between 0.09 - 0.01 and 0.09 + 0.01 and l_quantity < 24; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1474408.75..1474408.76 rows=1 width=8) (actual time=21330.323..21330.323 rows=1 loops=1) Buffers: shared hit=708156 read=328613 dirtied=513 written=2132 -> Bitmap Heap Scan on lineitem (cost=191343.09..1472497.80 rows=382191 width=8) (actual time=4221.937..21156.790 rows=380132 loops=1) Recheck Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-01-01'::date)) Filter: ((l_discount >= 0.08::double precision) AND (l_discount <= 0.1::double precision) AND (l_quantity < 24::double precision)) Rows Removed by Filter: 8731187 Heap Blocks: exact=1011896 Buffers: shared hit=708156 read=328613 dirtied=513 written=2132 -> Bitmap Index Scan on lineitem_l_shipdate_l_suppkey__idx (cost=0.00..191247.54 rows=9163498 width=0) (actual time=3786.250..3786.250 rows=9183791 loops=1) Index Cond: ((l_shipdate >= '1997-01-01'::date) AND (l_shipdate < '1998-01-01'::date)) Buffers: shared read=24873 written=27 Planning time: 2.115 ms Execution time: 21334.958 ms (13 rows) COMMIT; COMMIT