Re: correct example of a functional index usage?

From: Dennis Gearon <gearond(at)fireserve(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: correct example of a functional index usage?
Date: 2004-10-22 14:25:05
Message-ID: 41791841.8060607@fireserve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-10-22 14:59:57 Re: correct example of a functional index usage?
Previous Message Richard_D_Levine 2004-10-22 14:21:10 Re: Two questions from the boss (SQL:2003 && scalability)