From: | Manfred Koizar <mkoi-pg(at)aon(dot)at> |
---|---|
To: | Andreas Schlegel <schlegelaw(at)gmx(dot)de> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Index and performance |
Date: | 2002-12-16 07:23:43 |
Message-ID: | 4ouqvus1ig4qsvclh91ugkggkkra9i9nbg@4ax.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sun, 15 Dec 2002 22:45:49 +0100, Andreas Schlegel
<schlegelaw(at)gmx(dot)de> wrote:
>The PRIMARY KEY consists of COL1 and COL2. But if I run a query only on
>the not unique COL1 is it better for the query performance to have a
>separate index or is the existence of the primary key sufficient?
*If* the index is used (and if col2 is not extremely wide), the
performance impact of an unused index column shouldn't be noticeable.
However, I have seen cases where the presence of additional index
columns fooled the planner into not choosing the index scan. The
decision depends mainly on the selectivity of your col1 condition and
on how well the tuples are sorted by col1.
EXPLAIN ANALYZE is your friend.
Servus
Manfred
From | Date | Subject | |
---|---|---|---|
Next Message | Jules Alberts | 2002-12-16 09:01:11 | how to find referenced column and table |
Previous Message | Kevin Brown | 2002-12-16 07:15:49 | Re: [HACKERS] [GENERAL] PostgreSQL Global Development Group |