Unique Constraint vs Unique Index - Mailing list pgsql-novice

From JORGE MALDONADO
Subject Unique Constraint vs Unique Index
Date
Msg-id CAAY=A7-2us_KLeqeYO98qfg0zOW1+2rHzscDvC-ZpWEOMdYYRg@mail.gmail.com
Whole thread Raw
Responses Re: Unique Constraint vs Unique Index  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: Unique Constraint vs Unique Index  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-novice
Hi,

I have been reading about "unique constraint" and "unique index" in PostgreSQL documentation and also did some search in Google. However, it is not very clear to me which one to use or when to use one or the other. I understand that a "unique constraint" creates a "unique index" under the hood. So, at the end, both will check for duplicate records based on the field(s) specified for the unique constraint and the unique index.

What would be a guideline about when to use one or the other?

Respectfully,
Jorge Maldonado

pgsql-novice by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: ON CONFLlCT DO UPDATE command cannot affect row a second time
Next
From: Alvaro Herrera
Date:
Subject: Re: Unique Constraint vs Unique Index