Thomas Beutin <tyrone(at)laokoon(dot)IN-Berlin(dot)DE> writes:
> tb=# EXPLAIN select count(distinct a_id) from stat_pages WHERE m_id = 35 AND ( visit >= '2002-12-01' OR visit <= '2002-12-11');
Do you really mean OR there, and not AND? As given, the query looks
mighty unselective to me --- I'd think it should *not* use an index.
The planner evidently thinks so too. (How accurate is the rowcount
estimate, anyway?)
regards, tom lane