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 1mH43R-00008C-I3 for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Aug 2021 12:55:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mH43P-00018X-BH for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Aug 2021 12:55:23 +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 1mH43O-00018P-Tm for pgsql-hackers@lists.postgresql.org; Fri, 20 Aug 2021 12:55:23 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mH43K-0005ub-6Z for pgsql-hackers@lists.postgresql.org; Fri, 20 Aug 2021 12:55:22 +0000 Received: by mail-io1-xd2d.google.com with SMTP id b7so12128310iob.4 for ; Fri, 20 Aug 2021 05:55:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Jm5IAqBTVGxxFBxdJPcZ0W+stIE9cq4COjaCCt9+pWs=; b=x4Opvr6cglYLOqdFe50PssHLRsnvcRwVYbodMy8+eYggyrYPYlEZi0IGrA1fkU/IVI kPW46UAfXxrqcvdHhn/YzhTWhavOB9VxrfxBc8sXH/BSufgPI2I/epKXYDmZaakBxg7R R/h/NVinYB/ZwvuRECBa8w5C0cZQznqcc6LQ27EA1TMabJAlw9axk0SYNO9HzrPek4fN JYtrpgwA8ERUvjhdq62zbeGJUdpgqrmctX6yyXfvFmJYiy+nlmwbZGeZGs7zzPza9Ifn pTf45SJZgeVBl/5I2vDpj/lsPZpuRsITgDqICkJLet1kCh0RFPFVp+xsDdgcsG4WwFid kfpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=Jm5IAqBTVGxxFBxdJPcZ0W+stIE9cq4COjaCCt9+pWs=; b=gMqa1Sn3zSzkn6By2BgeCXNirGfjqDMXJA+0EA/8zgaEQsoLTaeBXiHmqtNqbVALFu KgQgHM/gGNZfgsFrDjaZ75PTV5Ns4PP3nmVOx43QQ4N9EHUmfyc3aqlVHrlEShmvSRuI pxl9GvY+ZZ++DxooZ+Q/JKpANFrsRlkhIl2fkmnwAR2qN/knO65JV4pfiqnvOG0FwYHF Oz4l7zNDM8WuH/0mR+glUmHTp6luwQQtMbMq6fHEZbDTVjGmnZyo9xtFPy7zEjk1zpFe JPC6nElbVMDVF0H7DsSzyQReWCRFa0E1qyWhhfHIhs8KntXge+ymbBBfTMHYOQ95k5sb jVCg== X-Gm-Message-State: AOAM533LyJiqN7LbH5MZB3amfz3rcvo48bcoSU3r3Q08j3Ny8sKuXsbf afCxvPt1wP/5f4ve8kSgwbYleA== X-Google-Smtp-Source: ABdhPJxJcsZ7aE6CmpRZnpkKAKXQ9nNgVLpYw9by3DF3930p2P0n7O9M/kBvohYVppSwzQhp03Zqfw== X-Received: by 2002:a5d:8941:: with SMTP id b1mr15903801iot.45.1629464115458; Fri, 20 Aug 2021 05:55:15 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id p16sm3322688ilg.32.2021.08.20.05.55.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Aug 2021 05:55:14 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id D9C578006C6; Fri, 20 Aug 2021 07:55:13 -0500 (CDT) Date: Fri, 20 Aug 2021 07:55:13 -0500 From: Justin Pryzby To: =?iso-8859-1?Q?=C1lvaro?= Herrera Cc: Andres Freund , Kyotaro HORIGUCHI , yuzuko , Tomas Vondra , David Steele , Kyotaro Horiguchi , Daniel Gustafsson , Amit Langote , Masahiko Sawada , Laurenz Albe , pgsql-hackers@lists.postgresql.org, Greg Stark , Michael Paquier , Peter Geoghegan , Andrew Dunstan Subject: Re: Autovacuum on partitioned table (autoanalyze) Message-ID: <20210820125513.GQ10479@telsasoft.com> References: <202108161546.3zuouk76skr4@alvherre.pgsql> <202108162142.crk2myigb2ad@alvherre.pgsql> <20210816222810.GE10479@telsasoft.com> <20210817113018.GG10479@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210817113018.GG10479@telsasoft.com> 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, Aug 17, 2021 at 06:30:18AM -0500, Justin Pryzby wrote: > On Mon, Aug 16, 2021 at 05:28:10PM -0500, Justin Pryzby wrote: > > On Mon, Aug 16, 2021 at 05:42:48PM -0400, Álvaro Herrera wrote: > > > On 2021-Aug-16, Álvaro Herrera wrote: > > > > > > > Here's the reversal patch for the 14 branch. (It applies cleanly to > > > > master, but the unused member of PgStat_StatTabEntry needs to be > > > > removed and catversion bumped). > > > > > > I have pushed this to both branches. (I did not remove the item from > > > the release notes in the 14 branch.) > > > > | I retained the addition of relkind 'p' to tables included by > > | pg_stat_user_tables, because reverting that would require a catversion > > | bump. > > > > Right now, on v15dev, it shows 0, which is misleading. > > Shouldn't it be null ? > > > > analyze_count | 0 > > > > Note that having analyze_count and last_analyze would be an an independently > > useful change. Since parent tables aren't analyzed automatically, I have a > > script to periodically process them if they weren't processed recently. Right > > now, for partitioned tables, the best I could find is to check its partitions: > > | MIN(last_analyzed) FROM pg_stat_all_tables psat JOIN pg_inherits i ON psat.relid=i.inhrelid > > > > In 20200418050815.GE26953@telsasoft.com I wrote: > > |This patch includes partitioned tables in pg_stat_*_tables, which is great; I > > |complained awhile ago that they were missing [0]. It might be useful if that > > |part was split out into a separate 0001 patch (?). > > | [0] https://www.postgresql.org/message-id/20180601221428.GU5164%40telsasoft.com > > I suggest the attached (which partially reverts the revert), to allow showing > correct data for analyze_count and last_analyzed. Álvaro, would you comment on this ? To me this could be an open item, but someone else should make that determination. -- Justin