Re: Index non-usage problem in 8.2.9

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Index non-usage problem in 8.2.9
Дата
Msg-id 12690.1220416272@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Index non-usage problem in 8.2.9  (Joseph S <jks@selectacast.net>)
Список pgsql-general
Joseph S <jks@selectacast.net> writes:
> Actually sacode is an int2.

Ah.  8.2 is not very good at proving cross-type predicate conditions,
because it lacks the concept of an operator family.  You need to declare
the index this way:

create index d2i on d2 (sgcode, sacode)
  WHERE sacode IS NOT NULL AND sacode > 0::int2;

(As previously noted, you don't really need the IS NOT NULL part of the
condition, but that isn't what's causing the problem here.)

            regards, tom lane

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

Предыдущее
От: Artacus
Дата:
Сообщение: Re: Oracle and Postgresql
Следующее
От: aderose
Дата:
Сообщение: Re: vacuum analyze hurts performance