Re: Index on multiple columns VS multiple index

From: "Jonathan S(dot) Katz" <jonathan(dot)katz(at)excoventures(dot)com>
To: Brice André <brice(at)famille-andre(dot)be>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Index on multiple columns VS multiple index
Date: 2014-01-02 19:22:59
Message-ID: 260BFF81-D9DB-4A71-9D17-2BD7C1F4C343@excoventures.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

> Hello everyone,
>
> I have a question concerning index : suppose I have a table with fields 'a' and 'b' and that all requests perform WHERE clauses on 'a' field, and some requests also perform WHERE clauses on 'b' fields. What is the best approach for indexing strategy:
> One index on 'a' and one on 'b'
> One index on both columns 'a' and 'b'
> A combination of both solutions ?

Could you clarify your question a bit? Are you saying your queries are predominantly

SELECT ... FROM table WHERE a = ?

With some queries that are

SELECT ... FROM table WHERE a = ? AND b = ?

Thanks,

Jonathan

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jonathan S. Katz 2014-01-02 19:33:44 Re: Index on multiple columns VS multiple index
Previous Message Brice André 2014-01-02 19:17:46 Index on multiple columns VS multiple index