pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Benjamin Krajmalnik <kraj@servoyant.com>
To: pgsql-performance@postgresql.org
Subject: Quesion on the use of indexes
Date: Mon, 16 Aug 2010 21:22:57 -0600
Message-ID: <F4E6A2751A2823418A21D4A160B689887B0362@fletch.stackdump.local> (raw)

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.

view thread (4+ messages)  latest in thread

Message-ID: <F4E6A2751A2823418A21D4A160B689887B0362@fletch.stackdump.local>
Permalink:  ../F4E6A2751A2823418A21D4A160B689887B0362@fletch.stackdump.local/
Also on:    postgresql.org/message-id/F4E6A2751A2823418A21D4A160B689887B0362@fletch.stackdump.local

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: kraj@servoyant.com
  Subject: Re: Quesion on the use of indexes
  In-Reply-To: <F4E6A2751A2823418A21D4A160B689887B0362@fletch.stackdump.local>
  References: <F4E6A2751A2823418A21D4A160B689887B0362@fletch.stackdump.local>

* 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