Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-performance by date

Next:From: Martin SarsaleDate: 2004-08-30 18:07:15
Subject: Re: seqscan instead of index scan
Previous:From: Bruno Wolff IIIDate: 2004-08-30 18:02:27
Subject: Re: seqscan instead of index scan

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group