Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: 2024-03-30 12:40:43
Message-ID: CAPpHfdsCCV8DOv0Ovu4dTSnuWXiEz_AjuW-J6TPj++tcfEGvRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Dmitry!

Thank you for your feedback!

On Wed, Mar 27, 2024 at 10:18 PM Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru> wrote:
> > I've fixed that by skipping a copy of the identity of another
> > partition (remove CREATE_TABLE_LIKE_IDENTITY from
> > TableLikeClause.options).
>
> Thanks for correction!
> Probably I should have looked at the code more closely after commit [1].
> I'm also very glad that situation [2] was reproduced.
>
> > When merging partitions you're creating a merged partition like the
> > parent table. But when splitting a partition you're creating new
> > partitions like the partition being split. What motivates this
> > difference?
>
> When splitting a partition, I planned to set parameters for each of the
> new partitions (for example, tablespace parameter).
> It would make sense if we want to transfer part of the data of splitting
> partition to a slower (archive) storage device.
> Right now I haven't seen any interest in this functionality, so it
> hasn't been implemented yet. But I think this will be needed in the future.

OK, I've changed the code to use the parent table as a template for
new partitions in split case. So, now it's the same in both split and
merge cases.

I also added a special note into docs about ACCESS EXCLUSIVE lock,
because I believe that's a significant limitation for usage of this
functionality.

I think 0001, 0002 and 0003 could be considered for pg17. I will
continue reviewing them.

0004 might require more work. I didn't rebase it for now. I suggest
we can rebase it later and consider for pg18.

------
Regards,
Alexander Korotkov

Attachment Content-Type Size
0001-ALTER-TABLE-MERGE-PARTITIONS-command-v27.patch application/octet-stream 105.2 KB
0002-ALTER-TABLE-SPLIT-PARTITION-command-v27.patch application/octet-stream 176.1 KB
0003-Documentation-for-ALTER-TABLE-SPLIT-PARTITION-ME-v27.patch application/octet-stream 9.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2024-03-30 13:35:37 Re: pgbnech: allow to cancel queries during benchmark
Previous Message Robert Haas 2024-03-30 12:00:23 Re: Combine Prune and Freeze records emitted by vacuum