postgresql/src
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
..
backend Reset relhassubclass upon attaching table as a partition 2024-07-24 12:38:18 +02:00
bin pg_upgrade: Retrieve subscription count more efficiently. 2024-07-24 11:30:33 -05:00
common Replace some strtok() with strsep() 2024-07-22 15:45:46 +02:00
fe_utils Fix PL/pgSQL's handling of integer ranges containing underscores. 2024-06-04 11:48:01 +01:00
include Refactor tidstore.c iterator buffering. 2024-07-24 17:32:35 +12:00
interfaces Fix outdated comment after removal of direct SSL fallback 2024-07-08 12:44:45 +03:00
makefiles Optimize pg_popcount() with AVX-512 instructions. 2024-04-06 21:56:23 -05:00
pl Doc: improve description of plpgsql's FETCH and MOVE commands. 2024-07-22 19:43:12 -04:00
port Add port/ replacement for strsep() 2024-07-22 09:50:30 +02:00
template Remove AIX support 2024-02-28 15:17:23 +04:00
test Reset relhassubclass upon attaching table as a partition 2024-07-24 12:38:18 +02:00
timezone Update time zone data files to tzdata release 2024a. 2024-02-01 15:57:53 -05:00
tools Use atomics to avoid locking in InjectionPointRun() 2024-07-15 10:22:11 +03:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Apply COPT to CXXFLAGS as well 2024-07-01 07:30:55 +02:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00