pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Benjamin Krajmalnik <kraj@servoyant.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Quesion on the use of indexes
Date: Mon, 16 Aug 2010 23:33:29 -0400
Message-ID: <29298.1282016009@sss.pgh.pa.us> (raw)
In-Reply-To: <F4E6A2751A2823418A21D4A160B689887B0362@fletch.stackdump.local>
References: <F4E6A2751A2823418A21D4A160B689887B0362@fletch.stackdump.local>

"Benjamin Krajmalnik" <kraj@servoyant.com> writes:
> A little background - I have various multi-column indexes whenever I
> have queries which restrict the output based on the values of the 2
> fields (for example, a client code and the date of a transaction).

> Is there a performance gain using this approach as opposed to using 2
> separate indexes, one on the first column and one on the second column?

Maybe, maybe not ... it's going to depend on a bunch of factors, one of
which is what your update load is like compared to the queries that read
the indexes.  There's a bit of coverage of this in the fine manual: see
http://www.postgresql.org/docs/8.4/static/indexes-multicolumn.html
and the next few pages.

The short of it is that there's no substitute for doing your own
experiments for your own application ...

			regards, tom lane



view thread (4+ messages)  latest in thread

Message-ID: <29298.1282016009@sss.pgh.pa.us>
Permalink:  ../29298.1282016009@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29298.1282016009@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, kraj@servoyant.com
  Subject: Re: Quesion on the use of indexes
  In-Reply-To: <29298.1282016009@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