postgresql/src/bin
Nathan Bossart 364509a2e7 pg_upgrade: Retrieve subscription count more efficiently.
Presently, pg_upgrade obtains the number of subscriptions in the
to-be-upgraded cluster by first querying pg_subscription in every
database for the number of subscriptions in only that database.
Then, in count_old_cluster_subscriptions(), it adds all the values
collected in the first step.  This is expensive, especially when
there are many databases.

Fortunately, there is a better way to retrieve the subscription
count.  Since pg_subscription is a shared catalog, we only need to
connect to a single database and query it once.  This commit
modifies pg_upgrade to use that approach, which also allows us to
trim several lines of code.  In passing, move the call to
get_db_subscription_count(), which has been renamed to
get_subscription_count(), from get_db_rel_and_slot_infos() to the
dedicated >= v17 section in check_and_dump_old_cluster().

We may be able to make similar improvements to
get_old_cluster_logical_slot_infos(), but that is left as a future
exercise.

Reviewed-by: Michael Paquier, Amit Kapila
Discussion: https://postgr.es/m/ZprQJv_TxccN3tkr%40nathan
Backpatch-through: 17
2024-07-24 11:30:33 -05:00
..
initdb Translation updates 2024-06-24 13:11:27 +02:00
pg_amcheck Translation updates 2024-06-24 13:11:27 +02:00
pg_archivecleanup Convert some extern variables to static 2024-07-02 07:26:22 +02:00
pg_basebackup Fix unstable test in 040_pg_createsubscriber. 2024-07-12 09:29:21 +05:30
pg_checksums Convert some extern variables to static 2024-07-02 07:26:22 +02:00
pg_combinebackup Do not summarize WAL if generated with wal_level=minimal. 2024-07-18 12:09:48 -04:00
pg_config Translation updates 2024-06-24 13:11:27 +02:00
pg_controldata Translation updates 2024-06-24 13:11:27 +02:00
pg_ctl Improve pg_ctl's message for shutdown after recovery. 2024-07-18 13:48:58 -04:00
pg_dump Use CREATE DATABASE ... STRATEGY = FILE_COPY in pg_upgrade. 2024-07-08 16:18:00 -05:00
pg_resetwal Translation updates 2024-06-24 13:11:27 +02:00
pg_rewind Convert some extern variables to static 2024-07-02 07:26:22 +02:00
pg_test_fsync Translation updates 2024-06-24 13:11:27 +02:00
pg_test_timing Convert some extern variables to static 2024-07-02 07:26:22 +02:00
pg_upgrade pg_upgrade: Retrieve subscription count more efficiently. 2024-07-24 11:30:33 -05:00
pg_verifybackup Run pgperltidy 2024-07-01 07:35:01 +09:00
pg_waldump Translation updates 2024-06-24 13:11:27 +02:00
pg_walsummary Translation updates 2024-06-24 13:11:27 +02:00
pgbench Fix placement of "static". 2024-07-05 17:32:55 -04:00
pgevent Update copyright for 2024 2024-01-03 20:49:05 -05:00
psql Allow altering of two_phase option of a SUBSCRIPTION. 2024-07-24 10:13:36 +05:30
scripts Make sure to run pg_isready on correct port 2024-07-13 08:06:53 -04:00
Makefile Add new pg_walsummary tool. 2024-01-11 12:48:27 -05:00
meson.build Add new pg_walsummary tool. 2024-01-11 12:48:27 -05:00