agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Jonathan S. Katz <jonathan.katz@excoventures.com>
To: Brice André <brice@famille-andre.be>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: Index on multiple columns VS multiple index
Date: Thu, 2 Jan 2014 15:06:28 -0500
Message-ID: <B8172ABC-0EB4-4859-8D93-A7CB11DA6785@excoventures.com> (raw)
In-Reply-To: <CAOBG12nTYcd-QfhLBg2UQK1cRQwQh8_0bcjqhwrgac0DDTrAaw@mail.gmail.com>
References: <CAOBG12m10zcGwHY_g8+Mwhs2sXjBvue5EqidHGj+pZtH3XFCXw@mail.gmail.com>
	<260BFF81-D9DB-4A71-9D17-2BD7C1F4C343@excoventures.com>
	<CAOBG12nmg+fheEgoqk=B4zHd-6tqfwAkFt1H6G=cz6e5bXr_QQ@mail.gmail.com>
	<97DDB603-D01D-4355-872A-5913DBBC5268@excoventures.com>
	<CAO+EYw+T2Aj6xP0w4oNzPiBPdXykssRRJFO_c01dCpXQVuAqFA@mail.gmail.com>
	<CAOBG12nTYcd-QfhLBg2UQK1cRQwQh8_0bcjqhwrgac0DDTrAaw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

On Jan 2, 2014, at 3:00 PM, Brice André wrote:

> But I have still one question that remains : 
> 
> suppose I define an index on ('a', 'b') columns, will it be useful for a search on 'a' column only, or will it be ignore by postgresl ?

If you define the index on ('a', 'b') in that order and are just searching for 'a' in your query, the query planner will use the index.

Jonathan



-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (9+ messages)  latest in thread

Message-ID: <B8172ABC-0EB4-4859-8D93-A7CB11DA6785@excoventures.com>
Permalink:  ../B8172ABC-0EB4-4859-8D93-A7CB11DA6785@excoventures.com/
Also on:    postgresql.org/message-id/B8172ABC-0EB4-4859-8D93-A7CB11DA6785@excoventures.com

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-sql@postgresql.org
  Cc: jonathan.katz@excoventures.com, brice@famille-andre.be
  Subject: Re: Index on multiple columns VS multiple index
  In-Reply-To: <B8172ABC-0EB4-4859-8D93-A7CB11DA6785@excoventures.com>

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

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