Re: Creating indexes

From: "Matthew T(dot) O'Connor" <matthew(at)tocr(dot)com>
To: robert(at)webtent(dot)com
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Creating indexes
Date: 2007-12-10 17:04:42
Message-ID: 475D71AA.2070707@tocr.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Robert Fitzpatrick wrote:
> Now my question, would it be better to create one index with all columns
> in the table -or- a separate index for each column field? I was assuming
> the latter, but would the index with all columns be beneficial as well?

Generally it's much better to have an index deal with only one column.
Also I wouldn't just randomly throw an index on every column. You
should only index the columns that used for the constraints. You might
benefit from turning up the logging and looking at what queries are
slow, then play with them and viewing their explain output with /
without indexes.

Extra indexes that aren't really doing anything can actually hurt
performance during vacuum or insert / update / delete.

Matt

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2007-12-10 17:08:47 Re: Simpler dump?
Previous Message Obe, Regina 2007-12-10 16:54:32 Re: Simpler dump?