Re: seqscan instead of index scan

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: seqscan instead of index scan
Дата
Msg-id 6EE64EF3AB31D5448D0007DD34EEB3412A748D@Herge.rcsinc.local
обсуждение исходный текст
Ответ на seqscan instead of index scan  (Martin Sarsale <martin@emepe3.net>)
Ответы Re: seqscan instead of index scan  (Martin Sarsale <martin@emepe3.net>)
Список pgsql-performance
> Im having a weird problem here. I have a table w/ ~180.000 rows and I
> want to select those where c > 0 or d > 0 (there only a few of those
on
> the table)
> I indexed columns c and d (separately) but this query used the slow
> seqscan instead of the index scan:

create function is_somethingable (ctype, dtype) returns boolean as
'
    return case when $1 > 0 and $2 > 0 then true else false end;
' language sql immutable;

create index t_idx on t(is_somethingable(c,d));

analyze t;

select * from t where is_somethingable(t.c, t.d) = true;

Merlin


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: seqscan instead of index scan
Следующее
От: Martin Sarsale
Дата:
Сообщение: Re: seqscan instead of index scan