Go to file
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
.github Add CODE_OF_CONDUCT.md, CONTRIBUTING.md, and SECURITY.md. 2024-07-02 13:03:58 -05:00
config jit: Remove {llvm-config,clang}-N configure probes. 2024-05-16 13:58:25 +12:00
contrib pg_stat_statements: Add regression test for privilege handling. 2024-07-24 20:54:51 +09:00
doc Fix a missing article in the documentation 2024-07-24 14:13:55 +02:00
src pg_upgrade: Retrieve subscription count more efficiently. 2024-07-24 11:30:33 -05:00
.cirrus.star
.cirrus.tasks.yml ci: Use newer LLVM version with gcc, to avoid compiler warnings 2024-07-15 15:04:15 -07:00
.cirrus.yml
.dir-locals.el
.editorconfig
.git-blame-ignore-revs Add a couple of recent commits to .git-blame-ignore-revs. 2024-07-16 11:04:55 -05:00
.gitattributes
.gitignore
aclocal.m4
configure Add port/ replacement for strsep() 2024-07-22 09:50:30 +02:00
configure.ac Add port/ replacement for strsep() 2024-07-22 09:50:30 +02:00
COPYRIGHT
GNUmakefile.in Allow selecting the git revision to be packaged by "make dist". 2024-05-03 11:08:50 -04:00
HISTORY
Makefile
meson_options.txt Allow selecting the git revision to be packaged by "make dist". 2024-05-03 11:08:50 -04:00
meson.build Add port/ replacement for strsep() 2024-07-22 09:50:30 +02:00
README.md

PostgreSQL Database Management System

This directory contains the source code distribution of the PostgreSQL database management system.

PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.

Copyright and license information can be found in the file COPYRIGHT.

General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.

The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.