From: | Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Difference between PRIMARY KEY index and UNIQUE-NOT NULL index |
Date: | 2007-07-20 22:45:34 |
Message-ID: | 200707210045.34915.Vincenzo.Romano@notorand.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 -= NotOrAnd.IT Information Technologies =-
tel +39 0823 454163 | cel +39 339 8083886 | fax +39 02 700506964
<Smooth seas never make experienced sailormen>
From | Date | Subject | |
---|---|---|---|
Next Message | Vincenzo Romano | 2007-07-20 22:54:26 | Difference between PRIMARY KEY index and UNIQUE-NOT NULL index |
Previous Message | Lew | 2007-07-20 22:45:17 | Re: Foreign key constraint question |