Re: If an index is based on 3 columns will a query using two of the columns utilize the index?
От
Reid Thompson
Тема
Re: If an index is based on 3 columns will a query using two of the columns utilize the index?
Дата
Msg-id
F71C0DC6B4FD3648815AAA7F969E35290194F1FE@sr002-2kexc.ateb.com
Список
Дерево обсуждения
Re: If an index is based on 3 columns will a query using two of the columns utilize the index? "Reid Thompson" <Reid.Thompson@ateb.com>
Re: If an index is based on 3 columns will a query using two of the columns utilize the index? Michael Fuhr <mike@fuhr.org>
Re: If an index is based on 3 columns will a query using two of the columns utilize the index? Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: If an index is based on 3 columns will a query using two of the columns utilize the index? Tom Lane <tgl@sss.pgh.pa.us>
Re: If an index is based on 3 columns will a query using Teodor Sigaev <teodor@sigaev.ru>
Re: If an index is based on 3 columns will a query using two of the columns utilize the index? Tom Lane <tgl@sss.pgh.pa.us>
Alvaro Herrera wrote: > On Mon, Sep 12, 2005 at 09:43:57AM -0400, Reid Thompson wrote: >> Example: >> assume a table of 10 columns, three of which are fname, lname, and >> dob. If an index is created on (fname, lname, dob), will a query that >> utilizes two of the columns ( select 'data' from table where fname = >> 'X' and lname = 'Y') utilize the index? > > Yes, if it is selective enough. (It _can_ use the index, > which does not mean that it _will_ use it.) Note that if > your example query used the columns (lname, dob), the answer would be > "no." > Why is that? In order to use an index, does the query have to utilize the 'first' element of the index? reid
В списке pgsql-general по дате отправления
От: Michael Fuhr
Дата:
От: Michael Fuhr
Дата: