pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Claudio Freire <klaussfreire@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Carlo Stonebanks <stonec.register@sympatico.ca>
Cc: pgsql-performance@postgresql.org
Subject: Re: Composite keys
Date: Mon, 31 Oct 2011 14:59:19 -0400
Message-ID: <5180.1320087559@sss.pgh.pa.us> (raw)
In-Reply-To: <CAGTBQpb1E7jQBn1S-yBCMo2w=V+iQRed-sDqNTj=cKPnYRicRg@mail.gmail.com>
References: <CCB4B01D184042ECBBE456D1ACB185A4@CAPRICA>
	<CAGTBQpYMzj+xufEQBr7_aL3ZjZWaADU1oF40-ji8n8GcpZLj1A@mail.gmail.com>
	<CA+TgmoY4Q+CyvxEVcNRjtMH_HeCP+uNXkrC8goVDVktsbAPNnA@mail.gmail.com>
	<CAGTBQpb1E7jQBn1S-yBCMo2w=V+iQRed-sDqNTj=cKPnYRicRg@mail.gmail.com>

Claudio Freire <klaussfreire@gmail.com> writes:
> On Mon, Oct 31, 2011 at 2:08 PM, Robert Haas <robertmhaas@gmail.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



view thread (11+ messages)

Message-ID: <5180.1320087559@sss.pgh.pa.us>
Permalink:  ../5180.1320087559@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5180.1320087559@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, klaussfreire@gmail.com, robertmhaas@gmail.com, stonec.register@sympatico.ca
  Subject: Re: Composite keys
  In-Reply-To: <5180.1320087559@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox