Re: speedup COPY TO for partitioned table.

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: speedup COPY TO for partitioned table.
Date: 2025-10-16 02:56:28
Message-ID: CACJufxEHB7=ck6Jun8znbwN7UQE21TsvZgMAUFLjw3jXkS=3RQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 16, 2025 at 9:21 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> > Please check the attached v18.
>
> Thank you for updating the patch!
>
> I've reviewed the patch and here is one review comment:
>
> from->inh = false; /* apply ONLY */
> + if (get_rel_relkind(relid) == RELKIND_PARTITIONED_TABLE)
> + from->inh = true;
>
> It's better to check rel->rd_rel->relkind instead of calling
> get_rel_relkind() as it checks syscache.
>
> I've attached a patch to fix the above and includes some cosmetic
> changes. Please review it.
>

hi.

overall looks good to me, thanks for polishing it.

+ * However, when copying data from a partitioned table, we don't
+ * not use "ONLY", since we need to retrieve rows from its
+ * descendant tables too.

I guess here it should be
"we don't use "ONLY"
?

I’ve incorporated your changes into v19.

Attachment Content-Type Size
v19-0001-support-COPY-partitioned_table-TO.patch text/x-patch 17.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-10-16 03:01:51 Re: Should we say "wal_level = logical" instead of "wal_level >= logical"
Previous Message Chao Li 2025-10-16 02:54:12 Re: Optimize LISTEN/NOTIFY