Re: Creating indexes - Mailing list pgsql-general

From Matthew T. O'Connor
Subject Re: Creating indexes
Date
Msg-id 475D71AA.2070707@tocr.com
Whole thread Raw
In response to Creating indexes  (Robert Fitzpatrick <lists@webtent.net>)
List 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


pgsql-general by date:

Previous
From: Robert Fitzpatrick
Date:
Subject: Creating indexes
Next
From: "Josh Harrison"
Date:
Subject: slony question