From 53da8083556364490d42077492e608152f9ae02e Mon Sep 17 00:00:00 2001 From: Laurenz Albe Date: Wed, 18 Jan 2023 10:09:21 +0100 Subject: [PATCH] Improve autovacuum doc on partitioned tables The documentation mentioned that autovacuum doesn't process partitioned tables, but it was unclear about the impact. The old wording could be interpreted to mean that there are problems with dead tuple cleanup on partitioned tables. Clarify that the only potential problem is autoanalyze, and that statistics for the partitions will be gathered. Author: Laurenz Albe Reviewed-by: Nathan Bossart, Justin Pryzby Discussion: https://postgr.es/m/1fd81ddc7710a154834030133c6fea41e55c8efb.camel%40cybertec.at --- doc/src/sgml/maintenance.sgml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index 759ea5ac9c..3954e797a4 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -860,8 +860,15 @@ analyze threshold = analyze base threshold + analyze scale factor * number of tu - Partitioned tables are not processed by autovacuum. Statistics - should be collected by running a manual ANALYZE when it is + The partitions of a partitioned table are normal tables and get processed + by autovacuum, but autovacuum doesn't process the partitioned table itself. + This is no problem as far as VACUUM is concerned, since + processing the partitions is sufficient. But, as mentioned in + , it also means that autovacuum won't + run ANALYZE on the partitioned table itself. + While statistics are gathered on the partitions, some queries may rely on + the statistics for the partitioned table. You should collect statistics by + running a manual ANALYZE when the partitioned table is first populated, and again whenever the distribution of data in its partitions changes significantly. -- 2.39.0