Re: Quesion on the use of indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Benjamin Krajmalnik" <kraj(at)servoyant(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Quesion on the use of indexes
Date: 2010-08-17 03:33:29
Message-ID: 29298.1282016009@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Benjamin Krajmalnik" <kraj(at)servoyant(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message fiala_marek 2010-08-17 07:26:19 Search query is curious
Previous Message Benjamin Krajmalnik 2010-08-17 03:22:57 Quesion on the use of indexes