Re: Index Scans Oddness

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Index Scans Oddness
Дата
Msg-id 1188.1002916075@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Index Scans Oddness  (Orion <o2@trustcommerce.com>)
Список pgsql-general
Orion <o2@trustcommerce.com> writes:
>         select * from foo where text_field like 'foo%'
> will do an index scan with my data in 7.0.3 but not 7.1.3-1PGDG.
> Makes me think there's a bug.

Yes: in 7.0.  You're probably running in a non-C locale, wherein
optimizing LIKE with an indexscan is unsafe.

>         select * from foo where order_date = current_date
> and
>         select * from foo
>         where order_date < to_date(xxx) and order_date > to_date(yyy)

> Both do sequence scans where current date is indexed

The problem is probably lack of cachability of current_date and to_date().
You can fix this with a wrapper function that's marked "iscachable".
Look in the mailing list archives for prior discussions.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: "Relation x does not exist" error when x does exist
Следующее
От: Palle Girgensohn
Дата:
Сообщение: Re: Unixtime from timedate?