Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHtJq-0002qJ-22 for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jan 2023 21:16:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pHtJp-0002v9-0i for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jan 2023 21:16:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHtJo-0002uz-Ni for pgsql-hackers@lists.postgresql.org; Tue, 17 Jan 2023 21:16:32 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHtJh-0007T4-TY for pgsql-hackers@postgresql.org; Tue, 17 Jan 2023 21:16:31 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1pHtJc-00B8ID-Qu; Tue, 17 Jan 2023 16:16:20 -0500 Date: Tue, 17 Jan 2023 16:16:20 -0500 From: Bruce Momjian To: Justin Pryzby Cc: Nathan Bossart , Laurenz Albe , Tomas Vondra , Robert Haas , =?utf-8?Q?=C3=81lvaro?= Herrera , yuzuko , pgsql-hackers@postgresql.org Subject: Re: document the need to analyze partitioned tables Message-ID: References: <681e76ad-3a7b-ea3c-b6b0-55946239c49b@enterprisedb.com> <20220121180200.GM23027@telsasoft.com> <19c248d9-3687-9e0f-0b1a-2adad1de6fbe@enterprisedb.com> <20220315230011.GZ28503@telsasoft.com> <88903179-5ce2-3d4d-af43-7830372bdcb6@enterprisedb.com> <1fd81ddc7710a154834030133c6fea41e55c8efb.camel@cybertec.at> <20230112232747.GA2111950@nathanxps13> <20230117210050.GX9837@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230117210050.GX9837@telsasoft.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jan 17, 2023 at 03:00:50PM -0600, Justin Pryzby wrote: > On Tue, Jan 17, 2023 at 03:53:24PM -0500, Bruce Momjian wrote: > > On Thu, Jan 12, 2023 at 03:27:47PM -0800, Nathan Bossart wrote: > > > Here is my take on the wording: > > > > > > Since all the data for a partitioned table is stored in its partitions, > > > autovacuum does not process partitioned tables. Instead, autovacuum > > > processes the individual partitions that are regular tables. This > > > means that autovacuum only gathers statistics for the regular tables > > > that serve as partitions and not for the partitioned tables. Since > > > queries may rely on a partitioned table's statistics, you should > > > collect statistics via the ANALYZE command when it is first populated, > > > and again whenever the distribution of data in its partitions changes > > > significantly. > > > > Uh, what about autovacuum's handling of partitioned tables? This makes > > it sound like it ignores them because it talks about manual ANALYZE. > > If we're referring to the *partitioned* table, then it does ignore them. > See: > > |commit 6f8127b7390119c21479f5ce495b7d2168930e82 > |Author: Alvaro Herrera > |Date: Mon Aug 16 17:27:52 2021 -0400 > | > | Revert analyze support for partitioned tables Yes, I see that patch was trying to combine the statistics of individual partitions into a partitioned table summary. > Maybe (all?) the clarification the docs need is to say: > "Partitioned tables are not *themselves* processed by autovacuum." Yes, I think the lack of autovacuum needs to be specifically mentioned since most people assume autovacuum handles _all_ statistics updating. Can someone summarize how bad it is we have no statistics on partitioned tables? It sounds bad to me. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Embrace your flaws. They make you human, rather than perfect, which you will never be.