> 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