Re: seqscan instead of index scan

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Martin Sarsale" <martin(at)emepe3(dot)net>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: seqscan instead of index scan
Date: 2004-08-30 18:06:48
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB3412A748D@Herge.rcsinc.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Martin Sarsale 2004-08-30 18:07:15 Re: seqscan instead of index scan
Previous Message Bruno Wolff III 2004-08-30 18:02:27 Re: seqscan instead of index scan