Re: Multi-Column List Partitioning

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: Multi-Column List Partitioning
Дата
Msg-id CA+HiwqEWR2Mgf65rQA6vYuvkUby33yi2MKSWH5HGnO+URDbBKw@mail.gmail.com
обсуждение исходный текст
Ответ на Multi-Column List Partitioning  (Nitin Jadhav <nitinjadhavpostgres@gmail.com>)
Ответы Re: Multi-Column List Partitioning  (Amit Langote <amitlangote09@gmail.com>)
Список pgsql-hackers
Hello Nitin,

On Thu, May 6, 2021 at 11:03 PM Nitin Jadhav
<nitinjadhavpostgres@gmail.com> wrote:
>
> Hi,
>
> While reviewing one of the 'Table partitioning' related patches, I found that Postgres does not support multiple
columnbased LIST partitioning. Based on this understanding, I have started working on this feature. I also feel that
'Multi-ColumnList Partitioning' can be benefited to the Postgres users in future. 

Yes, it would be nice to have this.  Thanks for picking this up.

> I am attaching the WIP patch for this feature here. It supports 'Multi-Column List Partitioning', however some tasks
arestill pending. I would like to know your thoughts about this, So that I can continue the work with improvising the
currentpatch. 
>
> Following things are handled in the patch.
> 1. Syntax
>
> CREATE TABLE table_name (attrs) PARTITION BY LIST(list_of_columns);
>
> Earlier there was no provision to mention multiple columns as part of the 'list_of_columns' clause. Now we can
mentionthe list of columns separated by comma. 
>
> CREATE TABLE table_name_p1 PARTITION OF table_name FOR VALUES IN list_of_values.
>
> Whereas list_of_columns can be
> a. (value [,...])
> b. (value [,...]) [,...]
>
> I would like to list a few examples here for better understanding.
> Ex-1:
> CREATE TABLE t1(a int) PARTITION BY LIST(a);
> CREATE TABLE t1_1 PARTITION OF t1 FOR VALUES IN (1, 2, 10, 5, 7);
>
> Ex-2:
> CREATE TABLE t2(a int, b int) PARTITION BY LIST(a,b);
> CREATE TABLE t2_1 PARTITION OF t2 FOR VALUES IN (1, 2), (1, 5), (2, 2),(2, 10);

Hmm, why not have parentheses around these lists, that is: (
(list_of_values) [, ...] )

So your example would look like this:

CREATE TABLE t2_1 PARTITION OF t2 FOR VALUES IN ((1, 2), (1, 5), (2,
2), (2, 10));

IMO, it is not such a bad syntax from a user's PoV.  It's not hard to
understand from this syntax that the partition constraint is something
like (a, b) = (1, 2) OR (a, b) = (1, 5) OR ..., where the = performs
row-wise comparison.

I will now take a look at the patch itself.

--
Amit Langote
EDB: http://www.enterprisedb.com



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

Предыдущее
От: Masahiro Ikeda
Дата:
Сообщение: Re: Transactions involving multiple postgres foreign servers, take 2
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Addition of authenticated ID to pg_stat_activity