Re: Index and performance

Поиск
Список
Период
Сортировка
От Manfred Koizar
Тема Re: Index and performance
Дата
Msg-id 4ouqvus1ig4qsvclh91ugkggkkra9i9nbg@4ax.com
обсуждение исходный текст
Ответ на Index and performance  (Andreas Schlegel <schlegelaw@gmx.de>)
Список pgsql-general
On Sun, 15 Dec 2002 22:45:49 +0100, Andreas Schlegel
<schlegelaw@gmx.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Brian Minton
Дата:
Сообщение: ALTER TABLE vs. CREATE TABLE
Следующее
От: "Jules Alberts"
Дата:
Сообщение: how to find referenced column and table