RE: Initial COPY of Logical Replication is too slow

From: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Jan Wieck <jan(at)wi3ck(dot)info>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Initial COPY of Logical Replication is too slow
Date: 2026-03-26 05:44:01
Message-ID: TY4PR01MB169070FB24F396C18DDF5CF1E9456A@TY4PR01MB16907.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wednesday, March 25, 2026 2:07 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> On Tue, Mar 24, 2026 at 11:57 AM Masahiko Sawada
>
> I figured out that the join with pg_publication works as a filter; non-existence
> publication names are not passed to the function. If we pass the list of
> publication names to the new function signature, while we can simplify the
> patch and avoid a join, we would change the existing function behavior so that
> it ignores non-existence publications.
>
> I've attached the updated patch. The 0001 patch just incorporated the review
> comments so far, and the 0002 patch is a draft change for the above idea. Since
> pg_get_publication_tables(VARIADIC text) is not a documented function, I think
> we can accept small behavior changes. So I'm going to go with this direction.
> Feedback is very welcome.

Thanks for updating the patches. I have few comments for 0001:

1.

+ * specific table. Otherwise, if returns information for all tables within the
+ * specified publications.

if => it

2.

I think the function shall reject relids that do not reference a valid
publishable table (e.g., sequences, views, or materialized views).

3.

With publish_via_root = true, when both a partitioned table and its child are in
a publication, I expected passing the child's relid will return NULL (changes are
published via the root). Currently it returns the child's relid:

CREATE TABLE sales (
id SERIAL,
sale_date DATE NOT NULL
) PARTITION BY RANGE (sale_date);

CREATE TABLE sales_2024_q1 PARTITION OF sales
FOR VALUES FROM ('2024-01-01') TO ('2024-04-01');

CREATE publication pub for table sales, sales_2024_q1 with ( publish_via_partition_root );

select pg_get_publication_tables('pub', 'sales_2024_q1'::regclass);

Best Regards,
Hou zj

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Sharma 2026-03-26 06:05:37 Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication
Previous Message Shinya Kato 2026-03-26 05:40:37 Re: pg_stat_replication.*_lag sometimes shows NULL during active replication