Re: Partitioning and unique key

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Partitioning and unique key
Дата
Msg-id a2473f06464fde533ed499b53e2d87b79567fd21.camel@cybertec.at
обсуждение исходный текст
Ответ на Partitioning and unique key  (veem v <veema0000@gmail.com>)
Ответы Re: Partitioning and unique key
Список pgsql-general
On Sun, 2024-09-01 at 01:32 +0530, veem v wrote:
> due to postgres limitations we are unable to have this unique constraint or primary key
> only on the transaction_id column, we have to include transaction_timestamp with it as
> a composite key. So I want to understand from experts if there is any possible way to
> satisfy both partitioning on transaction_timestamp column and unique key or pk just on
> transaction_id only? 

No, you cannot have both.

Usually the solution is to *not* create a primary key on the partitioned table
and instead create a primary key on each partition.

That won't guarantee global uniqueness (and there is no way to do that), but it
goes a long way by ensuring that the column is unique within each partition.

Yours,
Laurenz Albe



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