postgres=# EXPLAIN SELECT COUNT(*) FROM stats WHERE (inc_tg_name='QWEST' OR out_tg_name='QWEST') AND (conn_date_month BETWEEN 9 AND 10 AND conn_date_year=2006);
QUERY PLAN
------------------------------------------------------------------------------------------------------
Aggregate (cost=2880149.96..2880149.97 rows=1 width=0)
-> Bitmap Heap Scan on stats (cost=49772.11..2870838.12 rows=3724737 width=0)
Recheck Cond: ((inc_tg_name = 'QWEST'::text) OR (out_tg_name = 'QWEST'::text))
Filter: ((conn_date_month >= 9) AND (conn_date_month <= 10) AND (conn_date_year = 2006))
-> BitmapOr (cost=49772.11..49772.11 rows=6620889 width=0)
-> Bitmap Index Scan on inc_tg_name_index (cost=0.00..21434.88 rows=2917680 width=0)
Index Cond: (inc_tg_name = 'QWEST'::text)
-> Bitmap Index Scan on out_tg_name_index (cost=0.00..28337.23 rows=3703209 width=0)
Index Cond: (out_tg_name = 'QWEST'::text)
(9 rows)