Re: correct example of a functional index usage?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: correct example of a functional index usage?
Дата
Msg-id 26016.1098405898@sss.pgh.pa.us
обсуждение исходный текст
Ответ на correct example of a functional index usage?  (Dennis Gearon <gearond@fireserve.net>)
Ответы Re: correct example of a functional index usage?  (Dennis Gearon <gearond@fireserve.net>)
Re: correct example of a functional index usage?  (Gaetano Mendola <mendola@bigfoot.com>)
Список pgsql-general
Dennis Gearon <gearond@fireserve.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Vic Cekvenich
Дата:
Сообщение: Re: repost(gmane): sql update max smartries
Следующее
От: Joel
Дата:
Сообщение: Re: OS X Install