Re: Index Question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Bierbryer, Andrew" <abierbryer(at)klsdiversified(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Index Question
Date: 2009-10-19 14:54:48
Message-ID: 5343.1255964088@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Bierbryer, Andrew" <abierbryer(at)klsdiversified(dot)com> writes:
> I have created a table where a unique row is defined by 5 columns and
> have created an index on these 5 columns. If I then do a select with a
> where clause that only consists of 3 of these columns, will I get the
> speed benefits from the index that I have created, or will I need to
> create another index with only these 3 columns?

It should work fine if those are the three leading columns of the index.
If they're not, you might want another index. This is not specific at
all to unique keys, it's a general property of multicolumn indexes.
Read
http://www.postgresql.org/docs/8.4/static/indexes.html
particularly 11.3 and 11.5

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2009-10-19 15:12:48 Re: Best practices for effective_io_concurrency
Previous Message Bierbryer, Andrew 2009-10-19 14:33:30 Index Question