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-19 20:44:22
Message-ID: ZprQJv_TxccN3tkr@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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().

[0] https://commitfest.postgresql.org/48/4995/

--
nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-07-19 21:04:53 Re: Build with LTO / -flto on macOS
Previous Message Thomas Simpson 2024-07-19 20:23:29 Re: Enhance pg_dump multi-threaded streaming (WAS: Re: filesystem full during vacuum - space recovery issues)