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