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 1k8a9W-0002Co-Lv for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Aug 2020 02:18:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k8a9V-0000ba-Jm for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Aug 2020 02:18:05 +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 1k8a9V-0000bS-D3 for pgsql-hackers@lists.postgresql.org; Thu, 20 Aug 2020 02:18:05 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k8a9S-0007kU-PU for pgsql-hackers@postgresql.org; Thu, 20 Aug 2020 02:18:05 +0000 Received: from hnk.local (p12054-ipngn2901funabasi.chiba.ocn.ne.jp [153.212.171.54]) by oss.nttdata.com (Postfix) with ESMTPSA id 03DC662344; Thu, 20 Aug 2020 11:17:58 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: Creating a function for exposing memory usage of backend process To: Andres Freund , Tom Lane Cc: Michael Paquier , torikoshia , PostgreSQL-development , Robert Haas , Kasahara Tatsuhito References: <34517933-7e90-f644-f606-86d7132b240b@oss.nttdata.com> <0b339b06646e2c56a3aa081699322346@oss.nttdata.com> <261eebda3e1909475162b968e5a4ad2b@oss.nttdata.com> <66ae5b88-208d-96fa-c20a-fb539b597859@oss.nttdata.com> <20200819135545.GC19121@paquier.xyz> <1414992.1597849297@sss.pgh.pa.us> <20200819225343.c7rxteydi35nhrdp@alap3.anarazel.de> <1554676.1597886946@sss.pgh.pa.us> <20200820014301.5pr7qjugnvpovu62@alap3.anarazel.de> From: Fujii Masao Message-ID: Date: Thu, 20 Aug 2020 11:17:58 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200820014301.5pr7qjugnvpovu62@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020/08/20 10:43, Andres Freund wrote: > Hi, > > On 2020-08-19 21:29:06 -0400, Tom Lane wrote: >> Andres Freund writes: >>> On 2020-08-19 11:01:37 -0400, Tom Lane wrote: >>>> I agree with that, but I think this patch has a bigger problem: >>>> why bother at all? It seems like a waste of code space and future >>>> maintenance effort, because there is no use-case. >> >>> I don't agree with this at all. I think there's plenty use cases. It's >>> e.g. very common to try to figure out why the memory usage of a process >>> is high. Is it memory not returned to the OS? Is it caches that have >>> grown too much etc. >> >> Oh, I agree completely that there are lots of use-cases for finding >> out what a process' memory map looks like. But this patch fails to >> address any of them in a usable way. > > Even just being able to see the memory usage in a queryable way is a > huge benefit. +1 > The difference over having to parse the log, then parse > the memory usage dump, and then aggregate the data in there in a > meaningful way is *huge*. We've been slacking around lowering our > memory usage, and I think the fact that it's annoying to analyze is a > partial reason for that. Agreed. > I totally agree that it's not *enough*, but in contrast to you I think > it's a good step. Subsequently we should add a way to get any backends > memory usage. > It's not too hard to imagine how to serialize it in a way that can be > easily deserialized by another backend. I am imagining something like > sending a procsignal that triggers (probably at CFR() time) a backend to > write its own memory usage into pg_memusage/ or something roughly > like that. Sounds good. Maybe we can also provide the SQL-callable function or view to read pg_memusage/, to make the analysis easier. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION