Re: Composite index planner issues Was: Re: Constraint exclusion oddity with composite index

Поиск
Список
Период
Сортировка
От Joshua D. Drake
Тема Re: Composite index planner issues Was: Re: Constraint exclusion oddity with composite index
Дата
Msg-id 46674ADD.2060904@commandprompt.com
обсуждение исходный текст
Ответ на Re: Composite index planner issues Was: Re: Constraint exclusion oddity with composite index  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Composite index planner issues Was: Re: Constraint exclusion oddity with composite index  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> "Joshua D. Drake" <jd@commandprompt.com> writes:
>>> I guess where I got confused is:
>>>
>>> http://www.postgresql.org/docs/8.1/static/indexes-multicolumn.html
>>>
>>> And explicitly:
>>>
>>> A multicolumn B-tree index can be used with query conditions that 
>>> involve any subset of the index's columns, but the index is most 
>>> efficient when there are constraints on the leading (leftmost) columns.
> 
>> Considering the paragraph from the documentation above, should we change 
>> the documentation?
> 
> That statement seems perfectly accurate to me.

O.k. then perhaps I am being dense, but that statement says to me that 
the planner should be able to use the right element of a composite index 
but that it will not always do so.

Considering an index of a,b if I search for b I would expect that the 
planner could use the index. Assuming of course that the planner would 
use the same index if it was just b.

Further, I would expect a smaller chance of it using b if the index was 
a,c,b but that it "might" still use it.

Is that not the case? Should I expect that even in the simplest of cases 
that we will not use an index unless it is *the* leftmost element?

Sincerely,

Joshua D. Drake




> 
>             regards, tom lane
> 



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Composite index planner issues Was: Re: Constraint exclusion oddity with composite index
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Composite index planner issues Was: Re: Constraint exclusion oddity with composite index