Quesion on the use of indexes

From: "Benjamin Krajmalnik" <kraj(at)servoyant(dot)com>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Quesion on the use of indexes
Date: 2010-08-17 03:22:57
Message-ID: F4E6A2751A2823418A21D4A160B689887B0362@fletch.stackdump.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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?

The reason I am asking is that my coding convetion goes back to the days
where I used ISAM tables, so the systems did not know how to use more
than a single index.

In some cases, I may have an index on (columna, columnb) and one on
(columnb, columna) due to the data access patterns. If there are no
performance gains in having these multi-part indexes, and performance
will be the same as having one index solely on columna and one solely on
columnb, then I can reduce the disk usage significantly in some cases.

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2010-08-17 03:33:29 Re: Quesion on the use of indexes
Previous Message Aaron Burnett 2010-08-17 02:19:48 Re: Very poor performance