Re: REPACK: warn about skipping foreign partitions

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: shihao zhong <zhong950419(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Antonin Houska <ah(at)cybertec(dot)at>
Subject: Re: REPACK: warn about skipping foreign partitions
Date: 2026-10-11 21:01:12
Message-ID: CAN4CZFM1g0oDs5Ee_5OWzf3YF-01rQDAak6ut_OWxEJJ+UmnXA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Especially when an index is specified, the patch adds another
> find_all_inheritors() call and loop while holding AccessExclusiveLock on
> the parent. Is this overhead unnoticeable and acceptable for tables
> with many small partitions?

After taking another look I think it's the opposite: we can avoid
another find_all_inheritors with plain REPACK, but we need at least
some find_inheritance_children calls for USING INDEX / CLUSTER as
foreign partitions don't have indexes.

v5 is this alternative approach (adding the warning inside
get_tables_to_repack_partitioned). I tried to measure them, but I
couldn't measure any difference between the two, only noise.

> So a partition can be dropped concurrently while warnings are being
> issued for foreign partitions, and get_rel_name(tableoid) can return NULL
> before the warning is emitted.

Oops, I missed that nested partitions can do this because we only lock
the top level parent. So yes, that null check is needed.

And because of this, I started thinking about why
find_all_inheritors(..., NoLock, ...) works at all with multi level
partition tables (root-parent-parent2-child) against a concurrent drop
of parent2 with only root locked... and it doesn't. That's an existing
race in vacuum/analyze/repack and lock table, I'll start a separate
thread about it tomorrow.

Attachment Content-Type Size
v5-0001-Warn-when-REPACK-or-CLUSTER-skips-a-foreign-table.patch application/octet-stream 10.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-10-11 21:40:28 Re: Bug in logical decoding with DDL and subtransactions
Previous Message David E. Wheeler 2026-10-11 20:42:35 Re: Policy for Abandoned Extensions