Re: Multiple column index usage question - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Multiple column index usage question
Date
Msg-id 20070120051208.GA16159@wolff.to
Whole thread Raw
In response to Re: Multiple column index usage question  ("Jeremy Haile" <jhaile@fastmail.fm>)
List pgsql-general
On Fri, Jan 19, 2007 at 18:20:47 -0500,
  Jeremy Haile <jhaile@fastmail.fm> wrote:
> That's interesting.  So if you have a composite index on two columns, is
> there much of a reason (usually) to create single indexes on each of the
> two columns?  I guess the single indexes might be slightly faster
> depending on the number of different values/combinations, so probably
> "it depends" eh?

You are normal going to want an index on just the second column in the
index or you do things where you are selecting a small subset of rows
based on the value of that column.

In some situations it may even make sense to have a separate index on just
the first column, because it will be more compact which will speed up
searches. However, you have to pay for maintaining the extra index when
changing the data so it often isn't worth it.

pgsql-general by date:

Previous
From: "Kelly Burkhart"
Date:
Subject: Re: Alter definition of a column
Next
From: "Matthew T. O'Connor"
Date:
Subject: Re: Help : Microsoft SQL Server equivalents in