Unique Constraint vs Unique Index

From: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
To: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Unique Constraint vs Unique Index
Date: 2020-05-05 19:12:19
Message-ID: CAAY=A7-2us_KLeqeYO98qfg0zOW1+2rHzscDvC-ZpWEOMdYYRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Alvaro Herrera 2020-05-05 19:36:26 Re: Unique Constraint vs Unique Index
Previous Message David G. Johnston 2020-04-30 18:09:38 Re: ON CONFLlCT DO UPDATE command cannot affect row a second time