Re: Tuning to speed select - Mailing list pgsql-general

From Tom Lane
Subject Re: Tuning to speed select
Date
Msg-id 16115.1155225263@sss.pgh.pa.us
Whole thread Raw
In response to Re: Tuning to speed select  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
Michael Fuhr <mike@fuhr.org> writes:
> Excerpt from the 8.1 Release Notes:
>   * Allow nonconsecutive index columns to be used in a multicolumn
>     index (Tom)

>     For example, this allows an index on columns a,b,c to be used in
>     a query with WHERE a = 4 and c = 10.

> If you're querying only on c then an index on (a,b,c) will probably
> be slower than an index on (c), but if you have only (a,b,c) then
> the planner will consider using it.

Note that if your query doesn't have a constraint on the first index
column, it's unlikely that that index will get chosen, because the
entire index would have to be scanned.  Before 8.1 it was guaranteed
not to be chosen.

            regards, tom lane

pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Tuning to speed select
Next
From: "Harpreet Dhaliwal"
Date:
Subject: Re: Connection string