From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Jeremy Haile <jhaile(at)fastmail(dot)fm> |
Cc: | Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Multiple column index usage question |
Date: | 2007-01-20 05:12:08 |
Message-ID: | 20070120051208.GA16159@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Jan 19, 2007 at 18:20:47 -0500,
Jeremy Haile <jhaile(at)fastmail(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Matthew T. O'Connor | 2007-01-20 05:30:50 | Re: Help : Microsoft SQL Server equivalents in |
Previous Message | Kelly Burkhart | 2007-01-20 04:50:38 | Re: Alter definition of a column |