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
>