But it is possible to use multiple indexes on dates, and that is why the one at the bottom works, right?
Would a single index get used for
SELECT appointment FROM the_table WHERE 0 <> (date_mask && date_range);
Tom Lane wrote:
No, an index can be used for one or the other. Since we don't yet have bitmap combining of indexes, you don't get to apply two indexes in a single query. Even if you did, this would be relatively inefficient since each index would return a whole lotta rows.
Why don't you just do the straightforward thing and look for
WHERE appointment_date >= 'some_date' AND appointment_date <= 'some-other-date'
AFAICS that solves the stated problem. Maybe you were not being clear about what you want?
regards, tom lane
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org