public inbox for [email protected]  
help / color / mirror / Atom feed
From: Crimean (gmail) <[email protected]>
To: [email protected]
Subject: Logical replication initialization time depends dramatically on the publication "schema" size
Date: Fri, 5 Jun 2026 12:11:19 +0200
Message-ID: <CACq0ybaVS8v2ouZfSJuSHX9bvgt=sJkwj=OYTzuv9UVxJN95fw@mail.gmail.com> (raw)

Hello,

I would like to report a scalability issue I observed during logical
replication initialization.

The problem is not that replication fails or behaves incorrectly. However,
initialization time appears to increase significantly as the number of
tables in a publication grows.

While investigating, I noticed the following query being executed:

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 = 236073
  AND c.oid = gpt.relid
  AND p.pubname IN ('p1');

According to AWS Performance Insights, this query shows an average latency
of more than 130 ms and approximately 113,799 buffer hits per execution
when the publication contains around 10,000 tables.

As a result, the subscription initialization rate degrades from roughly 28
tables/second with 500 tables in the publication to about 8 tables/second
with 10,000 tables.

In my environment, replication itself works correctly, but initialization
time increases substantially as publication size grows. Unfortunately, some
of my deployments contain very large schemas, with over 1 million tables on
the publisher side, making this behavior a practical problem.

I can provide PostgreSQL version information, execution plans, and
reproduction details if needed.

Thank you for your time.

Best regards,
Sergii


view thread (2+ 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]
  Subject: Re: Logical replication initialization time depends dramatically on the publication "schema" size
  In-Reply-To: <CACq0ybaVS8v2ouZfSJuSHX9bvgt=sJkwj=OYTzuv9UVxJN95fw@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