Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fV5m3-0005YR-3Q for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Jun 2018 01:49:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fV5m2-0003mM-0A for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Jun 2018 01:49:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fV5m1-0003mD-QR for pgsql-bugs@lists.postgresql.org; Tue, 19 Jun 2018 01:49:33 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fV5ly-0003dz-PI for pgsql-bugs@lists.postgresql.org; Tue, 19 Jun 2018 01:49:33 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id w5J1nQfD009477; Tue, 19 Jun 2018 10:49:26 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 740A4EA76C6; Tue, 19 Jun 2018 10:49:26 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 69879EA756E; Tue, 19 Jun 2018 10:49:26 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 62335400B41; Tue, 19 Jun 2018 10:49:26 +0900 (JST) Subject: Re: BUG #15245: pg_stat_all_tables does not include partition master tables References: <152922564661.24801.3078728743990100425@wrigleys.postgresql.org> <20180617120653.GD1411@paquier.xyz> <20180618020642.GC3721@paquier.xyz> <16ac0ae3-f0ba-536f-92e2-4a954dce8bbf@lab.ntt.co.jp> <20180618124943.GB1721@paquier.xyz> From: Amit Langote Message-ID: <4afa024b-dc62-cfed-41a3-d7975c66ed7a@lab.ntt.co.jp> Date: Tue, 19 Jun 2018 10:49:17 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180618124943.GB1721@paquier.xyz> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: Michael Paquier Cc: David Rowley , "David G. Johnston" , Mahadevan Ramachandran , "pgsql-bugs@lists.postgresql.org" X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018/06/18 21:49, Michael Paquier wrote: > On Mon, Jun 18, 2018 at 07:21:17PM +0900, Amit Langote wrote: >> I'm not sure of the vacuum (maybe NULL's the answer in that case), but if >> we ever teach autovacuum the ability to *analyze* partitioned tables, then >> we could simply record the time when that happens, instead of worrying >> about how to aggregate across partitions. We could leave that NULL for >> now, that is, if we decide to list partitioned tables in the >> pg_stat_all_tables output at all re OP's complaint. > > Even for the last_* columns, it is not really possible to have one > single definition for the partition parents. Here are a set of stats > which could be useful depending on the context: > > - average of the last runs. > - deviation of the last runs. > - Latest one which ran. > - Oldest one which ran. That seems to assume that we'll never support certain operations whose information appears in a row of a pg_stat_* view on partitioned table parents. For example, suppose we add a feature where autovacuum forks a worker to analyze partitioned table parent, wouldn't it be appropriate to have it reported via pg_stat_* with that table having its own entry? > The same applies for the tuples inserted and/or deleted, scans, > etc. Users may want to know the deviation to check for the balance > across partitions, or the sum of them, or even the average. For those > reasons having entries in pg_stat_all_tables or such for parent > partitions has little meaning, and having something which allows to grab > a complete partition tree has way more value because it becomes easier > to gather stats about the whole tree. Yes, if we have such partition tree structure exposing function, users can aggregate stats for partitions of a parent in all sorts of ways. But the question is whether a row in pg_stat_* view for a parent is responsible for showing it. If we ever have such rows, then I suppose it would show the same information for partitioned tables as they do for normal tables, but perhaps the amount of useful information would be much less than for normal tables. Thanks, Amit