Re: On partitioning, PKs and FKs

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Wiwwo Staff <wiwwo(at)wiwwo(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: On partitioning, PKs and FKs
Date: 2021-07-09 06:16:33
Message-ID: CAKFQuwbFHwNvkgL+W4rtk96CzHF5hQd2e4+TN3B3AvxM=dc5hQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday, July 8, 2021, Wiwwo Staff <wiwwo(at)wiwwo(dot)com> wrote:

> On Thu, 8 Jul 2021 at 21:42, Alban Hertroys <alban(dot)hertroys(at)apollotyres(dot)
> com> wrote:
>
>> On 2021-07-08 13:30, Ron wrote:
>> > Thus, the bigTable PK must be on id, columnX, (No, I don't like it
>> > either.)
>>
>> That's not entirely true. You can keep the PK on id if you additionally
>> create a unique constraint on (id, columnX).
>>
>
> Uhm, but that means that i have to partition by id *and* columnX, which
> is not what I really want...
>

Those examples show that Alban’s comment that you can keep the PK on id is
incorrect.

All you can do is ensure that a given non-partition value is unique on any
given partition. You cannot setup a constraint that definitionally
requires the entire partition tree to coordinate and ensure none of the
partitions have duplicates among them.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Elstermann, Mike 2021-07-09 06:39:32 Happy Birthday PostgreSQL! 25 Years! THX!
Previous Message Wiwwo Staff 2021-07-09 05:59:30 Re: On partitioning, PKs and FKs