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 1pHt4j-00018z-0J for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jan 2023 21:00:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pHt4h-0005IV-MA for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jan 2023 21:00:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHt4h-0005IM-DJ for pgsql-hackers@lists.postgresql.org; Tue, 17 Jan 2023 21:00:55 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pHt4f-0000TA-CZ for pgsql-hackers@postgresql.org; Tue, 17 Jan 2023 21:00:55 +0000 Received: by mail-il1-x129.google.com with SMTP id i17so11212804ila.9 for ; Tue, 17 Jan 2023 13:00:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=NthtP+v7egfmpu4ohy8GXdJVB7Pv6IO6/uycpxYngGM=; b=DMlhSeG0+Uh53+kEreSuCWc2MIMo2BYbXvAdnrkt6D+gjNgq/uJLp+5qzVyZWFUHI1 anRW/TOxO+83onkdCEnCPtiSyMA6bl1Y1xzlRmqpSLdCzrPI4rvURNyQRmiwa8xmPaky DfiUl6daZksCeiUAVu46iGF0MA1KatiaqAiWN+ifYnt4PImY/B2E3KH3TgQZKCWbDNhQ c12tJ6cKHQhiNOuyj35OkkxbM6OQc8HUWx2MR1pdebeJ74mqD/OuT9xziag+nX3+Ol1M 1lqM2HjRQtyyyuSuArR1yvVQ6RDDEdP6vI5ykAfJJJVsjGgD9BgwRjM8m8QClQK/pBZO PJQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NthtP+v7egfmpu4ohy8GXdJVB7Pv6IO6/uycpxYngGM=; b=uaArXmFTNiTJLXSy5I0ybDeSrUd7JdqssCUQw+2HUnpGZWz1z9bo7EuXTIKmoOgvk+ dAiOJ7PqY+Utxm4fkSWsUVkolRXD/TaiR5NX7HAT5jWF6+lioNjcNM/8Am36byh0kpaW tJsgZyuE0NxcRs0Stb3dYVdzJleOULRoBKUyqJfB95Bw/4q30b9nV6b/LNwYMezy26MU D8fnyaz56ujmjsXWsK10/CL4Pf5e9h0WMkXoA6IuXjBfg916pS5aduiY+4OSf4Wvtpbd 1GZkSoNNHxPaJ0zj879leq9cD6WTrj9FYQQdvFxMA1VnofJI8NIonqqcW6Y5e+EjDE8H /cHA== X-Gm-Message-State: AFqh2kowxJbJCQJVXATetK4AdWhnDZdhagiCAJgsY3DTpE7ULenRIVDf kKs0ysd94/dr7+mq/8hAuEscEWxXh1G48+5F X-Google-Smtp-Source: AMrXdXvrd6cLH6BjPzehlqRUZlenKTz+7N7l9qqxSR5k5mH5BGevk6WOooqBScTmONQlbgX0VEK5Ug== X-Received: by 2002:a92:d94e:0:b0:30b:e954:8365 with SMTP id l14-20020a92d94e000000b0030be9548365mr3372722ilq.3.1673989251727; Tue, 17 Jan 2023 13:00:51 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id b2-20020a056638388200b003884192cc05sm3018710jav.120.2023.01.17.13.00.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 13:00:51 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 6BF1D80074A; Tue, 17 Jan 2023 15:00:50 -0600 (CST) Date: Tue, 17 Jan 2023 15:00:50 -0600 From: Justin Pryzby To: Bruce Momjian Cc: Nathan Bossart , Laurenz Albe , Tomas Vondra , Robert Haas , =?iso-8859-1?Q?=C1lvaro?= Herrera , yuzuko , pgsql-hackers@postgresql.org Subject: Re: document the need to analyze partitioned tables Message-ID: <20230117210050.GX9837@telsasoft.com> References: <20211008125822.GJ27491@telsasoft.com> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: > > On Wed, Oct 05, 2022 at 10:37:01AM +0200, Laurenz Albe wrote: > > > On Mon, 2022-03-28 at 15:05 +0200, Tomas Vondra wrote: > > >> I've pushed the last version, and backpatched it to 10 (not sure I'd > > >> call it a bugfix, but I certainly agree with Justin it's worth > > >> mentioning in the docs, even on older branches). > > > > > > I'd like to suggest an improvement to this. The current wording could > > > be read to mean that dead tuples won't get cleaned up in partitioned tables. > > > > Well, dead tuples won't get cleaned up in partitioned tables, as > > partitioned tables do not have storage. But I see what you mean. Readers > > might misinterpret this to mean that autovacuum will not process the > > partitions. There's a good definition of what the docs mean by > > "partitioned table" [0], but FWIW it took me some time before I > > consistently read "partitioned table" to mean "only the thing with relkind > > set to 'p'" and not "both the partitioned table and its partitions." So, > > while the current wording it technically correct, I think it'd be > > reasonable to expand it to help avoid confusion. > > > > 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 Maybe (all?) the clarification the docs need is to say: "Partitioned tables are not *themselves* processed by autovacuum." -- Justin