agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: vacuumdb: Use ANALYZE ONLY for partitioned tables 2+ messages / 1 participants [nested] [flat]
* pgsql: vacuumdb: Use ANALYZE ONLY for partitioned tables @ 2026-08-13 05:25 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Fujii Masao @ 2026-08-13 05:25 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org vacuumdb: Use ANALYZE ONLY for partitioned tables When vacuumdb --analyze-only or --analyze-in-stages enumerates tables itself, it can select both a partitioned table and its partitions as separate work items. Previously, it generated plain ANALYZE for the partitioned table, which recursively analyzed its partitions as well. This caused duplicate work when the partitions were already selected by vacuumdb. With --analyze-in-stages, the redundant work could be repeated at every stage. Fix this by generating ANALYZE ONLY for automatically selected partitioned tables when connected to servers that support it. This updates inherited statistics for the partitioned table while leaving per-partition statistics to the separately selected partition entries. For older servers that do not support ANALYZE ONLY, vacuumdb falls back to the previous plain ANALYZE command. This also applies when partitioned tables are selected by schema filters. In that case, partitions matching the filters are analyzed as separate targets, while per-partition statistics for partitions outside the filters are not updated via the partitioned parent. This commit does not change the behavior for partitioned tables specified explicitly with --table, i.e., in that case, vacuumdb continues to generate plain ANALYZE, recursively analyzing the specified partitioned table and its partitions. Suggested-by: Justin Pryzby <pryzby@telsasoft.com> Author: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/aKZ7lMYGnnIo35c0@pryzbyj2023 Backpatch-through: 19 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/72e6184cd5fe82620693a2aae9e34452d1984459 Modified Files -------------- src/bin/scripts/t/100_vacuumdb.pl | 8 ++- src/bin/scripts/vacuuming.c | 120 +++++++++++++++++++++++++------------- src/tools/pgindent/typedefs.list | 2 + 3 files changed, 88 insertions(+), 42 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: vacuumdb: Use ANALYZE ONLY for partitioned tables @ 2026-08-13 05:25 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Fujii Masao @ 2026-08-13 05:25 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org vacuumdb: Use ANALYZE ONLY for partitioned tables When vacuumdb --analyze-only or --analyze-in-stages enumerates tables itself, it can select both a partitioned table and its partitions as separate work items. Previously, it generated plain ANALYZE for the partitioned table, which recursively analyzed its partitions as well. This caused duplicate work when the partitions were already selected by vacuumdb. With --analyze-in-stages, the redundant work could be repeated at every stage. Fix this by generating ANALYZE ONLY for automatically selected partitioned tables when connected to servers that support it. This updates inherited statistics for the partitioned table while leaving per-partition statistics to the separately selected partition entries. For older servers that do not support ANALYZE ONLY, vacuumdb falls back to the previous plain ANALYZE command. This also applies when partitioned tables are selected by schema filters. In that case, partitions matching the filters are analyzed as separate targets, while per-partition statistics for partitions outside the filters are not updated via the partitioned parent. This commit does not change the behavior for partitioned tables specified explicitly with --table, i.e., in that case, vacuumdb continues to generate plain ANALYZE, recursively analyzing the specified partitioned table and its partitions. Suggested-by: Justin Pryzby <pryzby@telsasoft.com> Author: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/aKZ7lMYGnnIo35c0@pryzbyj2023 Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9e725e77a5d8356a2237a15025b57d75b08e87e4 Modified Files -------------- src/bin/scripts/t/100_vacuumdb.pl | 8 ++- src/bin/scripts/vacuuming.c | 120 +++++++++++++++++++++++++------------- src/tools/pgindent/typedefs.list | 2 + 3 files changed, 88 insertions(+), 42 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-08-13 05:25 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-08-13 05:25 pgsql: vacuumdb: Use ANALYZE ONLY for partitioned tables Fujii Masao <fujii@postgresql.org> 2026-08-13 05:25 pgsql: vacuumdb: Use ANALYZE ONLY for partitioned tables Fujii Masao <fujii@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox