Re: Unique constraint across all partitions?

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Unique constraint across all partitions?
Дата
Msg-id 5ebaba7ee42d89f8bfb2599de203612024c86e8e.camel@cybertec.at
обсуждение исходный текст
Ответ на Re: Unique constraint across all partitions?  (Ron <ronljohnsonjr@gmail.com>)
Ответы Re: Unique constraint across all partitions?
Re: Unique constraint across all partitions?
Список pgsql-admin
On Mon, 2021-01-25 at 18:09 -0600, Ron wrote:
> > > > Is it possible to enforce a unique constraint across all partitions for 
> > > > either declarative or inheritance based partitioning? Preferably 
> > > > declarative based.
> > 
> > So, yes, so long as your unique constraint takes into consideration the partitioning scheme it will enforce
uniquenessacross all of the partitions.  But the answer to the full, but possibly
 
> > implied, question is no.
>  
> This is why global indices are needed.

Global indexes are likely more pain than gain.

They will make the best part of partitioning (attaching and detaching
partitions) painfully slow.  Hardly worth it to gain a tiny little bit
of integrity.  Within a partition, you can guarantee uniqueness easily.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




В списке pgsql-admin по дате отправления:

Предыдущее
От: Ron
Дата:
Сообщение: Re: Unique constraint across all partitions?
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: Unique constraint across all partitions?