public inbox for [email protected]  
help / color / mirror / Atom feed
From: Marcos Pegoraro <[email protected]>
To: Masahiko Sawada <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Initial COPY of Logical Replication is too slow
Date: Mon, 19 Jan 2026 14:44:18 -0300
Message-ID: <CAB-JLwZpp=7c9_r0beWWJxRh2BS_2Vvth8UDv7H57DBeaqggVg@mail.gmail.com> (raw)
In-Reply-To: <CAD21AoA6i2ui8FMZeuU_KxX4t-fM8G==zTW2Dp6-goujttrpew@mail.gmail.com>
References: <CAB-JLwbBFNuASyEnZWP0Tck9uNkthBZqi6WoXNevUT6+mV8XmA@mail.gmail.com>
	<CAD21AoA6i2ui8FMZeuU_KxX4t-fM8G==zTW2Dp6-goujttrpew@mail.gmail.com>

Em sex., 19 de dez. de 2025 às 22:59, Masahiko Sawada <[email protected]>
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


view thread (48+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Initial COPY of Logical Replication is too slow
  In-Reply-To: <CAB-JLwZpp=7c9_r0beWWJxRh2BS_2Vvth8UDv7H57DBeaqggVg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox