Difference between PRIMARY KEY index and UNIQUE-NOT NULL index

Поиск
Список
Период
Сортировка
От Vincenzo Romano
Тема Difference between PRIMARY KEY index and UNIQUE-NOT NULL index
Дата
Msg-id 200707210054.26881.vincenzo.romano@gmail.com
обсуждение исходный текст
Ответы Re: Difference between PRIMARY KEY index and UNIQUE-NOT NULL index  (Michael Glaesemann <grzm@seespotcode.net>)
Список pgsql-general
Hi all.
Maybe mine is a stupid question, but I'd like to know the answer if
possible.

In an inner join involving a 16M+ rows table and a 100+ rows table
performances got drastically improved by 100+ times by replacing a
UNIQUE-NOT NULL index with a PRIMARY KEY on the very same columns in
the very same order. The query has not been modified.

In the older case, thanks to the EXPLAIN command, I saw that the join
was causing a sort on the index elements, while the primary key was
not.

So ther's some difference for sure, but I'm missing it.
Any hint?

--
Vincenzo Romano
--
Maybe Computer will never become as intelligent as Humans.
For sure they won't ever become so stupid. [VR-1988]

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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: Feature request: Per database search_path
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: Difference between PRIMARY KEY index and UNIQUE-NOT NULL index