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

Re: seqscan instead of index scan

From: Martin Sarsale <martin(at)emepe3(dot)net>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: seqscan instead of index scan
Date: 2004-08-30 18:07:15
Message-ID: 1093889235.1680.77.camel@kadaif (view raw or flat)
Thread:
Lists: 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;


In response to

Responses

pgsql-performance by date

Next:From: Martin SarsaleDate: 2004-08-30 18:17:29
Subject: Re: seqscan instead of index scan
Previous:From: Merlin MoncureDate: 2004-08-30 18:06:48
Subject: Re: seqscan instead of index scan

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