From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Dennis Gearon <gearond(at)fireserve(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: correct example of a functional index usage? |
Date: | 2004-10-22 00:44:58 |
Message-ID: | 26016.1098405898@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Dennis Gearon <gearond(at)fireserve(dot)net> writes:
> I am trying to see if any of some
> appointments fall between two dates.
> the query looks like this:
> SELECT appointment
> FROM the_table
> WHERE date_mask < date_range
> AND
> flipped_date < flip_bits(the_table(date_mask));
> Now, I believe indexes are used for BOTH comparisons,
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
From | Date | Subject | |
---|---|---|---|
Next Message | Joel | 2004-10-22 02:20:16 | Re: OS X Install |
Previous Message | Vic Cekvenich | 2004-10-22 00:33:40 | Re: repost(gmane): sql update max smartries |