Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWMsx-0002oA-HX for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jan 2018 13:45:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWMsx-0000nc-3o for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jan 2018 13:45:43 +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.84_2) (envelope-from ) id 1eWMsw-0000nG-N0 for pgsql-hackers@lists.postgresql.org; Tue, 02 Jan 2018 13:45:42 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eWMss-0001Ik-R1 for pgsql-hackers@postgresql.org; Tue, 02 Jan 2018 13:45:41 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 7114F20BA8; Tue, 2 Jan 2018 08:45:35 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Tue, 02 Jan 2018 08:45:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Mcsm/L mY0w5knzEbjCzha1uxyhmSpN7n+8/UJ/FOg/A=; b=p1naHh+rtNVyH0f0devy9y 6GWiAfb0dJ27YCf90ogoLCJIufilp6o0KchkZCPEUhrdw0dB+4yMr6I4bRnwTBQp pmH/SuzOkoenGb8oRZK2pcl6I4rRR438jQzLHwcSHxpKZeonebSNiL3e9fsQ+xOP 9L4+1cWywuzlKmeVq3IGXjWn4bg7dZj/9nja5yd8JJQMMMoAWayV75e4yCASUiYt K6++6wh8RPJr2Cm+PCAMNNQXU4vQbX3LY/12eVyFgetaHHhiuiy2sNkq0d5wNA6x O7CAPaBkGAJy+9sElHPNg/sZVHm9+HBQphHGlOTmeS6A8sTG+u50ueowbBAm7udg == X-ME-Sender: Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 18F6E7E335; Tue, 2 Jan 2018 08:45:35 -0500 (EST) Subject: Re: pg_(total_)relation_size and partitioned tables To: David Rowley References: <495cec7e-f8d9-7e13-4807-90dbf4eec4ea@lab.ntt.co.jp> <1a78dea4-36b7-afb7-b3f3-1b4ff319fbb4@lab.ntt.co.jp> Cc: Amit Langote , Michael Paquier , Robert Haas , Pg Hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <93bef1b2-2ed0-c257-158e-efdf5b0ff9dd@2ndquadrant.com> Date: Tue, 2 Jan 2018 08:45:34 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/28/17 16:24, David Rowley wrote: >> select pg_partition_root(c.oid), c.relname, pg_table_size(c.oid) >> from pg_class c >> order by 1 >> >> select pg_partition_root(c.oid), sum(pg_table_size(c.oid)) >> from pg_class c >> group by 1 > > That seems much nicer. I assume "root" would mean the top level > partitioned table. If so, would we also want > pg_partition_parent(regclass)? Or maybe something to control the > number of "levels-up" the function would run for. If we had that then > maybe -1 could mean "go until you find a table with no parent". Hmm, we need to think through some scenarios for what one would really want to do with this functionality. Clearly, the existing behavior is useful for management tasks like bloat and vacuum monitoring. And on the other hand you might want to have a logical view of, how big is this partitioned table altogether. But what are the uses for dealing with partial partition hierarchies? How easy do we need to make that? -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services