Обсуждение: default partitions can be partitioned and have default partitions?

Поиск
Список
Период
Сортировка

default partitions can be partitioned and have default partitions?

От
Justin Pryzby
Дата:
postgres=# CREATE TABLE t(i int)PARTITION BY RANGE(i);
CREATE TABLE
postgres=# CREATE TABLE t0 PARTITION OF t DEFAULT PARTITION BY RANGE(i);
CREATE TABLE
postgres=# CREATE TABLE t00 PARTITION OF t0 DEFAULT; -- oh yes
CREATE TABLE
...

Not sure how it could be useful to partition default into subpartitions of
lists, ranges, hashes.

Justin



Re: default partitions can be partitioned and have default partitions?

От
Amit Langote
Дата:
On Sun, Sep 29, 2019 at 12:18 AM Justin Pryzby <pryzby@telsasoft.com> wrote:
> postgres=# CREATE TABLE t(i int)PARTITION BY RANGE(i);
> CREATE TABLE
> postgres=# CREATE TABLE t0 PARTITION OF t DEFAULT PARTITION BY RANGE(i);
> CREATE TABLE
> postgres=# CREATE TABLE t00 PARTITION OF t0 DEFAULT; -- oh yes
> CREATE TABLE

Actually, you can go even further

CREATE TABLE t00 PARTITION OF t0 DEFAULT PARTITION BY HASH (i);

> Not sure how it could be useful to partition default into subpartitions of
> lists, ranges, hashes.

Yeah, maybe the top-level partitioning should be designed such that
the default partition doesn't need sub-partitioning, but perhaps
Postgres shouldn't prevent users from trying it.  This was discussed
when the default partition feature went in; see [1].

Thanks,
Amit

[1] https://www.postgresql.org/message-id/CA%2BTgmoYh-hitRRUfxVxDVAjioYPrjhBCehePGRUa6qNNUnKvuw%40mail.gmail.com