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 1kjnQQ-0007rT-Tb for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Nov 2020 17:57:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kjnQP-00045g-1f for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Nov 2020 17:57:21 +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 1kjnQO-00045Z-72 for pgsql-hackers@lists.postgresql.org; Mon, 30 Nov 2020 17:57:20 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjnQJ-0005MT-Pl for pgsql-hackers@lists.postgresql.org; Mon, 30 Nov 2020 17:57:19 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 983185C00A2; Mon, 30 Nov 2020 12:57:12 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 30 Nov 2020 12:57:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=aeW4BuWOD2yBVZOIG Qf+EkaipARaEUeckxiVL2HQMVE=; b=p2hmNZOO/2/7sjIw0TkXUpBUq5XipVEcj r6mVdq7t4+EiFnSJERcO3g9RBSQRmuLUm0QjU8yM83rdoTt3xKEABaqXHEErPKYf K83ZlZ/luBZrw6CAlQwoSmkQ5jHVWuOuL0RsL5WPMJpPHi19Cf6o4PuqlB+3Jl94 hB1IDQ78gGAyvCO5UkOtpsVhcpv8hVp3mpeLnd2Jp7TfqpAfhpttxAaBbHd7ydbg gTnCNi642GgQyRxuva3FigKNzym23h7DzCv2q34fUVa4NO6n7kJ0q6KTwV8pnI2+ xAozqJeWc3YgW4AjWCqeMNNsNNIGs4Dsk9Fz1cuGl5ddn2pXX97Xw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeitddguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfggtggujggfsehttd ertddtredvnecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhr vgesrghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpeevgfelveegue ejgefhgeetgefhgeehieefheehleetteeiudeiiefhgffgheffteenucfkphepudeltddr leehrddukedrjeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.18.79]) by mail.messagingengine.com (Postfix) with ESMTPA id 752653280059; Mon, 30 Nov 2020 12:57:11 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 24F792A14FE; Mon, 30 Nov 2020 14:57:09 -0300 (-03) Date: Mon, 30 Nov 2020 14:57:09 -0300 From: Alvaro Herrera To: Kyotaro Horiguchi Cc: yuzukohosoya@gmail.com, pryzby@telsasoft.com, daniel@yesql.se, amitlangote09@gmail.com, masahiko.sawada@2ndquadrant.com, laurenz.albe@cybertec.at, pgsql-hackers@lists.postgresql.org, stark@mit.edu Subject: Re: Autovacuum on partitioned table (autoanalyze) Message-ID: <20201130175709.GA30970@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201110.203557.1420746510378864931.horikyota.ntt@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Nov-10, Kyotaro Horiguchi wrote: > In second thought about the reason for the "toprel_oid". It is perhaps > to avoid "wrongly" propagated values to ancestors after a manual > ANALYZE on a partitioned table. But the same happens after an > autoanalyze iteration if some of the ancestors of a leaf relation are > analyzed before the leaf relation in a autoanalyze iteration. That > can trigger an unnecessary analyzing for some of the ancestors. I'm not sure I understand this point. I think we should only trigger this on analyzes of *leaf* partitions, not intermediate partitioned relations. That way you would never get these unnecesary analyzes. Am I missing something? (So with my proposal in the previous email, we would send the list of ancestor relations after analyzing a leaf partition. Whenever we analyze a non-leaf, then the list of ancestors is sent as an empty list.) > > > Regarding the counters in pg_stat_all_tables: maybe some of these should be > > > null rather than zero ? Or else you should make an 0001 patch to fully > > > implement this view, with all relevant counters, not just n_mod_since_analyze, > > > last_*analyze, and *analyze_count. These are specifically misleading: > > > > > > last_vacuum | > > > last_autovacuum | > > > n_ins_since_vacuum | 0 > > > vacuum_count | 0 > > > autovacuum_count | 0 > > > > > I haven't modified this part yet, but you meant that we should set > > null to counters > > about vacuum because partitioned tables are not vacuumed? > > Perhaps bacause partitioned tables *cannot* be vacuumed. I'm not sure > what is the best way here. Showing null seems reasonable but I'm not > sure that doesn't break anything. I agree that showing NULLs for the vacuum columns is better. Perhaps the most reasonable way to do this is use -1 as an indicator that NULL ought to be returned from pg_stat_get_vacuum_count() et al, and add a boolean in PgStat_TableCounts next to t_truncated, maybe "t_nullvacuum" that says to store -1 instead of 0 in pgstat_recv_tabstat.