Re: pg_upgrade and logical replication - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: pg_upgrade and logical replication
Date
Msg-id ZpxsWx5jwlMCBZfn@nathan
Whole thread Raw
In response to Re: pg_upgrade and logical replication  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: pg_upgrade and logical replication
List 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

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Lock-free compaction. Why not?
Next
From: Tom Lane
Date:
Subject: Re: Lock-free compaction. Why not?