Re: Initial COPY of Logical Replication is too slow - Mailing list pgsql-hackers

From Marcos Pegoraro
Subject Re: Initial COPY of Logical Replication is too slow
Date
Msg-id CAB-JLwZpp=7c9_r0beWWJxRh2BS_2Vvth8UDv7H57DBeaqggVg@mail.gmail.com
Whole thread Raw
In response to Re: Initial COPY of Logical Replication is too slow  (Masahiko Sawada <sawada.mshk@gmail.com>)
Responses Re: Initial COPY of Logical Replication is too slow
List pgsql-hackers
Em sex., 19 de dez. de 2025 às 22:59, Masahiko Sawada <sawada.mshk@gmail.com> escreveu:
Yeah, if we pass a publication that a lot of tables belong to to
pg_get_publication_tables(), it could take a long time to return as it
needs to construct many entries.

Well, I don't know how to help but I'm sure it's working badly. 
Today I added some fields on my server, then seeing logs I could see how slow this process is. 

duration: 2213.872 ms  statement: SELECT DISTINCT  (CASE WHEN (array_length(gpt.attrs, 1) = c.relnatts)   THEN NULL ELSE gpt.attrs END)  FROM pg_publication p,  LATERAL pg_get_publication_tables(p.pubname) gpt,  pg_class c WHERE gpt.relid = 274376788 AND c.oid = gpt.relid   AND p.pubname IN ( 'mypub' )

2 seconds to get the list of fields of a table is really too slow.
How can we solve this ?

regards
Marcos

pgsql-hackers by date:

Previous
From: Kirill Reshke
Date:
Subject: Re: SQL:2011 Application Time Update & Delete
Next
From: Robert Haas
Date:
Subject: Re: Enhancing Memory Context Statistics Reporting