pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
[PATCH v2 1/2] Further adjust guidance for running vacuumdb after pg_upgrade. 4+ messages / 3 participants [nested] [flat]
* [PATCH v2 1/2] Further adjust guidance for running vacuumdb after pg_upgrade. @ 2025-04-23 15:11 Nathan Bossart <nathan@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Nathan Bossart @ 2025-04-23 15:11 UTC (permalink / raw) Since pg_upgrade does not transfer the cumulative statistics used for triggering autovacuum and autoanalyze, the server may take much longer than expected to process them post-upgrade. Currently, the pg_upgrade documentation recommends analyzing only relations for which optimizer statistics were not carried over during upgrade. This commit appends another recommendation to also analyze all relations to update the relevant cumulative statistics, similar to the recommendation for pg_stat_reset(). Reported-by: Christoph Berg <myon@debian.org> Reviewed-by: Christoph Berg <myon@debian.org> Discussion: https://postgr.es/m/aAfxfKC82B9NvJDj%40msg.df7cb.de --- doc/src/sgml/ref/pgupgrade.sgml | 12 +++++++----- src/bin/pg_upgrade/check.c | 9 ++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml index df13365b287..648c6e2967c 100644 --- a/doc/src/sgml/ref/pgupgrade.sgml +++ b/doc/src/sgml/ref/pgupgrade.sgml @@ -833,17 +833,19 @@ psql --username=postgres --file=script.sql postgres <para> Because not all statistics are not transferred by - <command>pg_upgrade</command>, you will be instructed to run a command to + <command>pg_upgrade</command>, you will be instructed to run commands to regenerate that information at the end of the upgrade. You might need to set connection parameters to match your new cluster. </para> <para> - Using <command>vacuumdb --all --analyze-only --missing-stats-only</command> - can efficiently generate such statistics. Alternatively, + First, use <command>vacuumdb --all --analyze-in-stages --missing-stats-only</command> - can be used to generate minimal statistics quickly. For either command, - the use of <option>--jobs</option> can speed it up. + to quickly generate minimal optimizer statistics for relations without + any. Then, use <command>vacuumdb --all --analyze-only</command> to ensure + all relations have updated cumulative statistics for triggering vacuum and + analyze. For both commands, the use of <option>--jobs</option> can speed + it up. If <varname>vacuum_cost_delay</varname> is set to a non-zero value, this can be overridden to speed up statistics generation using <envar>PGOPTIONS</envar>, e.g., <literal>PGOPTIONS='-c diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 18c2d652bb6..940fc77fc2e 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -814,9 +814,12 @@ output_completion_banner(char *deletion_script_file_name) } pg_log(PG_REPORT, - "Some optimizer statistics may not have been transferred by pg_upgrade.\n" - "Once you start the new server, consider running:\n" - " %s/vacuumdb %s--all --analyze-in-stages --missing-stats-only", new_cluster.bindir, user_specification.data); + "Some statistics are not transferred by pg_upgrade.\n" + "Once you start the new server, consider running these two commands:\n" + " %s/vacuumdb %s--all --analyze-in-stages --missing-stats-only\n" + " %s/vacuumdb %s--all --analyze-only", + new_cluster.bindir, user_specification.data, + new_cluster.bindir, user_specification.data); if (deletion_script_file_name) pg_log(PG_REPORT, -- 2.39.5 (Apple Git-154) --Yk+v15XI0xqDWTQr Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-vacuumdb-Don-t-skip-empty-relations-in-missing-st.patch" ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Enhance slot synchronization API to respect promotion signal. @ 2025-12-11 03:59 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Amit Kapila @ 2025-12-11 03:59 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Enhance slot synchronization API to respect promotion signal. Previously, during a promotion, only the slot synchronization worker was signaled to shut down. The backend executing slot synchronization via the pg_sync_replication_slots() SQL function was not signaled, allowing it to complete its synchronization cycle before exiting. An upcoming patch improves pg_sync_replication_slots() to wait until replication slots are fully persisted before finishing. This behaviour requires the backend to exit promptly if a promotion occurs. This patch ensures that, during promotion, a signal is also sent to the backend running pg_sync_replication_slots(), allowing it to be interrupted and exit immediately. Author: Ajin Cherian <itsajin@gmail.com> Reviewed-by: Shveta Malik <shveta.malik@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CAFPTHDZAA%2BgWDntpa5ucqKKba41%3DtXmoXqN3q4rpjO9cdxgQrw%40mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/1362bc33e025fd2848ff38558f5672e2f0f0c7de Modified Files -------------- src/backend/replication/logical/slotsync.c | 157 ++++++++++++++++++----------- 1 file changed, 99 insertions(+), 58 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Enhance slot synchronization API to respect promotion signal. @ 2026-04-08 02:25 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Fujii Masao @ 2026-04-08 02:25 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Enhance slot synchronization API to respect promotion signal. Previously, during a promotion, only the slot synchronization worker was signaled to shut down. The backend executing slot synchronization via the pg_sync_replication_slots() SQL function was not signaled, allowing it to complete its synchronization cycle before exiting. An upcoming patch improves pg_sync_replication_slots() to wait until replication slots are fully persisted before finishing. This behaviour requires the backend to exit promptly if a promotion occurs. This patch ensures that, during promotion, a signal is also sent to the backend running pg_sync_replication_slots(), allowing it to be interrupted and exit immediately. This change was originally committed to master only. However, backpatch it to v17, where slot synchronization was introduced. Because it is required for an upcoming bug fix addressing slotsync (including pg_sync_replication_slots()) blocking promotion when stuck in a wait. Author: Ajin Cherian <itsajin@gmail.com> Reviewed-by: Shveta Malik <shveta.malik@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CAFPTHDZAA%2BgWDntpa5ucqKKba41%3DtXmoXqN3q4rpjO9cdxgQrw%40mail.gmail.com Backpatch-through: 17 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/94efd308bcec9ecb45c2f1977c3c15bec383316e Author: Amit Kapila <akapila@postgresql.org> Modified Files -------------- src/backend/replication/logical/slotsync.c | 157 ++++++++++++++++++----------- 1 file changed, 99 insertions(+), 58 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Enhance slot synchronization API to respect promotion signal. @ 2026-04-08 02:26 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Fujii Masao @ 2026-04-08 02:26 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Enhance slot synchronization API to respect promotion signal. Previously, during a promotion, only the slot synchronization worker was signaled to shut down. The backend executing slot synchronization via the pg_sync_replication_slots() SQL function was not signaled, allowing it to complete its synchronization cycle before exiting. An upcoming patch improves pg_sync_replication_slots() to wait until replication slots are fully persisted before finishing. This behaviour requires the backend to exit promptly if a promotion occurs. This patch ensures that, during promotion, a signal is also sent to the backend running pg_sync_replication_slots(), allowing it to be interrupted and exit immediately. This change was originally committed to master only. However, backpatch it to v17, where slot synchronization was introduced. Because it is required for an upcoming bug fix addressing slotsync (including pg_sync_replication_slots()) blocking promotion when stuck in a wait. Author: Ajin Cherian <itsajin@gmail.com> Reviewed-by: Shveta Malik <shveta.malik@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CAFPTHDZAA%2BgWDntpa5ucqKKba41%3DtXmoXqN3q4rpjO9cdxgQrw%40mail.gmail.com Backpatch-through: 17 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4bed04d39566b788549ad157b32ccca9032bb4a1 Author: Amit Kapila <akapila@postgresql.org> Modified Files -------------- src/backend/replication/logical/slotsync.c | 157 ++++++++++++++++++----------- 1 file changed, 99 insertions(+), 58 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2026-04-08 02:26 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-04-23 15:11 [PATCH v2 1/2] Further adjust guidance for running vacuumdb after pg_upgrade. Nathan Bossart <nathan@postgresql.org> 2025-12-11 03:59 pgsql: Enhance slot synchronization API to respect promotion signal. Amit Kapila <akapila@postgresql.org> 2026-04-08 02:25 pgsql: Enhance slot synchronization API to respect promotion signal. Fujii Masao <fujii@postgresql.org> 2026-04-08 02:26 pgsql: Enhance slot synchronization API to respect promotion signal. Fujii Masao <fujii@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox