Re: Indexes & Primary Keys (based on the same columns) - Mailing list pgsql-general

From Joshua D. Drake
Subject Re: Indexes & Primary Keys (based on the same columns)
Date
Msg-id 471C1DE6.4090503@commandprompt.com
Whole thread Raw
In response to Indexes & Primary Keys (based on the same columns)  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
Responses Re: Indexes & Primary Keys (based on the same columns)  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
Re: Indexes & Primary Keys (based on the same columns)  (Bill Moran <wmoran@potentialtech.com>)
List pgsql-general
Ow Mun Heng wrote:
> I'm wondering if what I'm doing is redundant.
>
> I have a primary key on columns (A,B,C,D)
> and I've also defined an index based on the same columns (A,B,C,D)
>
> and sometimes in the query explain, I see the pkey being used for the
> scan instead of the index.
>
> So.. That made me think perhaps the additional index on the _same_
> parameter is redundant.

A primary key creates an index so having a second index with the same
definition is redundant.

>
> Appreciate comments.
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>


pgsql-general by date:

Previous
From: Ow Mun Heng
Date:
Subject: Indexes & Primary Keys (based on the same columns)
Next
From: Ow Mun Heng
Date:
Subject: Re: Indexes & Primary Keys (based on the same columns)