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

From Chester Kustarz
Subject Re: seqscan instead of index scan
Date
Msg-id Pine.BSO.4.44.0409011142140.23931-100000@detroit.arbor.net
Whole thread Raw
In response to Re: seqscan instead of index scan  (Martin Sarsale <martin@emepe3.net>)
List pgsql-performance
On Mon, 30 Aug 2004, Martin Sarsale wrote:
> "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;

You can use DeMorgan's Theorem to transform an OR clause to an AND clause.

In general:
    A OR B <=> NOT ((NOT A) AND (NOT B))

So:

> But I need something like:
>
> select * from t where c<>0 or d<>0;

    select * from t where not (c=0 and d=0);

I haven't actually tried to see if postgresql would do anything
interesting after such a transformation.




pgsql-performance by date:

Previous
From: G u i d o B a r o s i o
Date:
Subject: Re: [ADMIN] slower every day
Next
From: Josh Berkus
Date:
Subject: Re: Changing the column length