Re: Unique index

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rajesh Kumar <rajeshkumar(dot)dba09(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Unique index
Date: 2023-09-20 17:08:12
Message-ID: CAKFQuwYj8gq1Gu+b-vrLZrPk7Fd8YwMHP781Lechx0gTs5vZhA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wednesday, September 20, 2023, Rajesh Kumar <rajeshkumar(dot)dba09(at)gmail(dot)com>
wrote:
>
> Why unique index is used over unique constraints?
>

It’s rare that you would. Occasionally people want to enforce uniqueness
over a subset of the table - like if you want to ensure a maximum of one
active record (for a given id) at any given time but allow for multiple
historical records (for the same id) on the same table.

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Rajesh Kumar 2023-09-21 08:22:25 Pg_cron not working
Previous Message Erik Wienhold 2023-09-20 16:45:34 Re: Unique index