Re: pg_upgrade and logical replication

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Peter Smith <smithpb2250(at)gmail(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_upgrade and logical replication
Date: 2024-07-21 02:03:07
Message-ID: ZpxsWx5jwlMCBZfn@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 19, 2024 at 03:44:22PM -0500, Nathan Bossart wrote:
> I've been looking into optimizing pg_upgrade's once-in-each-database steps
> [0], and I noticed that we are opening a connection to every database in
> the cluster and running a query like
>
> SELECT count(*) FROM pg_catalog.pg_subscription WHERE subdbid = %d;
>
> Then, later on, we combine all of these values in
> count_old_cluster_subscriptions() to verify that max_replication_slots is
> set high enough. AFAICT these per-database subscription counts aren't used
> for anything else.
>
> This is an extremely expensive way to perform that check, and so I'm
> wondering why we don't just do
>
> SELECT count(*) FROM pg_catalog.pg_subscription;
>
> once in count_old_cluster_subscriptions().

Like so...

--
nathan

Attachment Content-Type Size
v1-0001-pg_upgrade-retrieve-subscription-count-more-effic.patch text/plain 5.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-07-21 02:13:50 Re: Lock-free compaction. Why not?
Previous Message David Rowley 2024-07-21 01:52:24 Re: Lock-free compaction. Why not?