Re: n00b question re: indexes and constraints - Mailing list pgsql-admin

From Wells Oliver
Subject Re: n00b question re: indexes and constraints
Date
Msg-id CAOC+FBXtsauGmMUSrg65Cay0ki8y+QTkexHU4bFFSRy5fASCKg@mail.gmail.com
Whole thread Raw
In response to Re: n00b question re: indexes and constraints  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: n00b question re: indexes and constraints  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: n00b question re: indexes and constraints  (Rui DeSousa <rui@crazybean.net>)
List pgsql-admin
Thanks, I should have been more specific, these are unique constraints I am concerned about: so yeah, creating an index on a set of columns where there's a unique constraint is redundant, correct?

On Wed, Apr 22, 2020 at 11:31 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wed, Apr 22, 2020 at 11:26 AM Wells Oliver <wells.oliver@gmail.com> wrote:
Are constraints also indexes, or would you want an additional index on top of a constraint if you wanted that column/combo indexed?

No, having a constraint does not imply that an index exists.  However, the enforcement of a "unique" constraint is implemented by auto-creating a unique index.

David J.



--

pgsql-admin by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: n00b question re: indexes and constraints
Next
From: "David G. Johnston"
Date:
Subject: Re: n00b question re: indexes and constraints