Re: MERGE/SPLIT PARTITIONS issues/questions

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: MERGE/SPLIT PARTITIONS issues/questions
Date: 2026-08-26 23:39:10
Message-ID: CAPpHfdvbZc134eg1oVMeHGzBC8A6oD013h31iNDFwSPoAwHtig@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Aug 26, 2026 at 12:06 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> I believe the original design first tries to lock the partitioned
> table with AccessExclusiveLock.
> Then, later patches incrementally reduce the lock level.
>
> Achieving the same result with ATTACH PARTITION requires the user to scan the
> data out, store it somewhere, and then scan it back in. MERGE/SPLIT PARTITION
> needs only a single scan. If we can lower the lock level on the
> parent table as well
> that would make the feature clearly worthwhile.

One can avoid the second scan by initially added relevant CHECK
constraint to the table, which is going to be the a new partition.
That allow subsequent ALTER TABLE ... ATTACH PARTITION to skip the
scan. Thus, manual procedure can at least avoid blocking reader for
long.

------
Regards,
Alexander Korotkov
Supabase

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Masahiko Sawada 2026-08-27 00:07:52 Re: autovacuum: automatically propagate updated parameters
Previous Message surya poondla 2026-08-26 23:28:48 Re: BUG #19369: Not documented that io_uring on kernel versions between 5.1 and below 5.6 does not work

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2026-08-27 00:51:39 Re: remove_useless_joins vs. bug #19560
Previous Message Henson Choi 2026-08-26 23:37:39 Re: [PATCH] Fix quotation logic for unreserved keywords in window specifications