Re: seqscan instead of index scan - Mailing list pgsql-performance

From Merlin Moncure
Subject Re: seqscan instead of index scan
Date
Msg-id 6EE64EF3AB31D5448D0007DD34EEB3412A748D@Herge.rcsinc.local
Whole thread Raw
In response to seqscan instead of index scan  (Martin Sarsale <martin@emepe3.net>)
Responses Re: seqscan instead of index scan
List 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 by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: seqscan instead of index scan
Next
From: Martin Sarsale
Date:
Subject: Re: seqscan instead of index scan