Re: Composite keys

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Claudio Freire <klaussfreire(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Carlo Stonebanks <stonec(dot)register(at)sympatico(dot)ca>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Composite keys
Date: 2011-10-31 18:59:19
Message-ID: 5180.1320087559@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Claudio Freire <klaussfreire(at)gmail(dot)com> writes:
> On Mon, Oct 31, 2011 at 2:08 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>>> Multicolumn indices on (c1, c2, ..., cn) can only be used on where
>>> clauses involving c1..ck with k<n.

>> I don't think that's true. I believe it can be used for a query that
>> only touches, say, c2. It's just extremely inefficient.

> Does postgres generate those kinds of plans?

Sure it does. It doesn't usually think they're efficient enough,
because they require full-index scans. But sometimes that's the
best you can do.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2011-10-31 19:55:35 Re: does update of column with no relation imply a relation check of other column?
Previous Message Merlin Moncure 2011-10-31 18:50:06 Re: SSL encryption makes bytea transfer slow