Re: Compund indexes and ORs

Поиск
Список
Период
Сортировка
Искать
От
Peter Eisentraut
Тема
Re: Compund indexes and ORs
Дата
Msg-id
Pine.LNX.4.44.0306071623080.2132-100000@peter.localdomain
Ответ на
Список
Дерево обсуждения
Compund indexes and ORs Dmitry Tkach <dmitry@openratings.com>
Re: Compund indexes and ORs Tom Lane <tgl@sss.pgh.pa.us>
Re: Compund indexes and ORs Dima Tkach <dmitry@openratings.com>
Re: Compund indexes and ORs Peter Eisentraut <peter_e@gmx.net>
Dmitry Tkach writes:

> explain select * from abc where a=1 and b in (1,2);
>
>                              QUERY PLAN
> ---------------------------------------------------------------------
>  Index Scan using abc_idx on abc  (cost=0.00..17.09 rows=1 width=12)
>    Index Cond: (a = 1)
>    Filter: ((b = 1) OR (b = 2))
>
>
> Now, why  doesn't it want to use the index for the second condition???

It can only use all columns of a multicolumn index if the columns are used
in clauses connected by OR.  This is described in the documentation.

-- 
Peter Eisentraut   peter_e@gmx.net
В списке pgsql-bugs по дате отправления
От: Dima Tkach
Дата:
Сообщение: Re: Compund indexes and ORs
От: Tom Lane
Дата:
Сообщение: Re: Compund indexes and ORs
FAQ