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

From Martin Sarsale
Subject Re: seqscan instead of index scan
Date
Msg-id 1093889235.1680.77.camel@kadaif
Whole thread Raw
In response to Re: seqscan instead of index scan  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: seqscan instead of index scan
Re: seqscan instead of index scan
List pgsql-performance
On Mon, 2004-08-30 at 15:02, Bruno Wolff III wrote:
> On Mon, Aug 30, 2004 at 14:46:37 -0300,

> > 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:
>
> Postgres doesn't 'or' bitmaps derived from two indexes. You might have more
> luck using a combined index.

With combined index, you mean a multiple column index?
From
http://www.postgresql.org/docs/7.4/interactive/indexes-multicolumn.html

"Multicolumn indexes can only be used if the clauses involving the
indexed columns are joined with AND. For instance,

SELECT name FROM test2 WHERE major = constant OR minor = constant;

cannot make use of the index test2_mm_idx defined above to look up both
columns. (It can be used to look up only the major column, however.) "

But I need something like:

select * from t where c<>0 or d<>0;



Attachment

pgsql-performance by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: seqscan instead of index scan
Next
From: Martin Sarsale
Date:
Subject: Re: seqscan instead of index scan