From: Martin Sarsale <martin@emepe3.net>
To: Bruno Wolff III <bruno@wolff.to>
Cc: pgsql-performance@postgresql.org
Subject: Re: seqscan instead of index scan
Date: Mon, 30 Aug 2004 15:07:15 -0300
Message-ID: <1093889235.1680.77.camel@kadaif> (raw)
In-Reply-To: <20040830180227.GA32520@wolff.to>
References: <1093887997.1680.71.camel@kadaif>
<20040830180227.GA32520@wolff.to>
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;
Attachments:
signature.asc (application/pgp-signature, 188B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: martin@emepe3.net, bruno@wolff.to
Subject: Re: seqscan instead of index scan
In-Reply-To: <1093889235.1680.77.camel@kadaif>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox