Re: seqscan instead of index scan

Поиск
Список
Период
Сортировка
От Chester Kustarz
Тема Re: seqscan instead of index scan
Дата
Msg-id Pine.BSO.4.44.0409011142140.23931-100000@detroit.arbor.net
обсуждение исходный текст
Ответ на Re: seqscan instead of index scan  (Martin Sarsale <martin@emepe3.net>)
Список 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 по дате отправления:

Предыдущее
От: G u i d o B a r o s i o
Дата:
Сообщение: Re: [ADMIN] slower every day
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Changing the column length