Re: Composite keys

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Claudio Freire <klaussfreire(at)gmail(dot)com>
Cc: Carlo Stonebanks <stonec(dot)register(at)sympatico(dot)ca>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Composite keys
Date: 2011-10-31 17:08:11
Message-ID: CA+TgmoY4Q+CyvxEVcNRjtMH_HeCP+uNXkrC8goVDVktsbAPNnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Oct 11, 2011 at 8:52 PM, Claudio Freire <klaussfreire(at)gmail(dot)com> wrote:
> On Tue, Oct 11, 2011 at 5:16 PM, Carlo Stonebanks
> <stonec(dot)register(at)sympatico(dot)ca> wrote:
>> Question 2) Regardless of the answer to Question 1 - if another_id is not
>> guaranteed to be unique, whereas pkey_id is – there any value to changing
>> the order of declaration (more generally, is there a performance impact for
>> column ordering in btree composite keys?)
>
> 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.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Claudio Freire 2011-10-31 17:52:14 Re: Composite keys
Previous Message Jens Reufsteck 2011-10-31 16:44:24 Re: Anti join miscalculates row number?