Re: On partitioning, PKs and FKs

Поиск
Список
Период
Сортировка
От Wiwwo Staff
Тема Re: On partitioning, PKs and FKs
Дата
Msg-id CAD1W9HX8MD-g=EQEfQBErCDOd7fz3Onb-66syvyYgchNrMiW2A@mail.gmail.com
обсуждение исходный текст
Ответ на On partitioning, PKs and FKs  (Wiwwo Staff <wiwwo@wiwwo.com>)
Ответы Re: On partitioning, PKs and FKs  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
On Thu, 8 Jul 2021 at 21:42, Alban Hertroys <alban.hertroys@apollotyres.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...
=> create table bigtable
(
    id      numeric primary key,
    columnX varchar(5),
    constraint test_unique unique (id, columnX)
) partition by hash (columnx);
ERROR:  0A000: unique constraint on partitioned table must include all partitioning columns
DETAIL:  PRIMARY KEY constraint on table "bigtable" lacks column "columnx" which is part of the partition key.
LOCATION:  DefineIndex, indexcmds.c:946
Time: 146.254 ms

Also
) partition by hash (id, columnx);
ERROR:  0A000: unique constraint on partitioned table must include all partitioning columns
DETAIL:  PRIMARY KEY constraint on table "bigtable" lacks column "columnx" which is part of the partition key.
LOCATION:  DefineIndex, indexcmds.c:946
Time: 150.646 ms

and
) partition by hash (id);
CREATE TABLE
Time: 152.780 ms
which is not what I want...

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

Предыдущее
От: Lucas
Дата:
Сообщение: Re: Need suggestions about live migration from PG 9.2 to PG 13
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: On partitioning, PKs and FKs