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 1oXeM8-0004ks-Ec for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Sep 2022 07:59:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oXeM7-000526-B3 for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Sep 2022 07:59:47 +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 1oXeM7-00051w-1O for pgsql-hackers@lists.postgresql.org; Mon, 12 Sep 2022 07:59:47 +0000 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oXeM5-0005Sx-4r for pgsql-hackers@lists.postgresql.org; Mon, 12 Sep 2022 07:59:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1662969585; x=1694505585; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to; bh=mY+Kq9o3DKtyZvpbmja2W6KcsOBSPlBSyOQnFj9SaK4=; b=ZcfQt1BnKaToYRb3Nhilmi1Ef9ypls8yKGBFgS/UzdPOaCVhmth6kY+b a06DPC9Pl0QcRKET6jnuKlr9MxdTH+oadEzt4zBIDVHGQvwTwQtuEb8gZ 7jLt2Emdc17nfoddmQi9xi1jgjoN/dJmieN4LUWKAoxL2QRz3B4Y3IHIJ 8=; X-IronPort-AV: E=Sophos;i="5.93,308,1654560000"; d="scan'208,217";a="258411651" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-iad-1d-54a073b7.us-east-1.amazon.com) ([10.25.36.210]) by smtp-border-fw-9102.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 07:59:22 +0000 Received: from EX13D03EUC003.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-iad-1d-54a073b7.us-east-1.amazon.com (Postfix) with ESMTPS id 9262F1A0091; Mon, 12 Sep 2022 07:59:20 +0000 (UTC) Received: from [192.168.28.248] (10.43.164.249) by EX13D03EUC003.ant.amazon.com (10.43.164.192) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Mon, 12 Sep 2022 07:59:18 +0000 Content-Type: multipart/alternative; boundary="------------H5EwmvAhDuPq6cxwlkgXQJin" Message-ID: <9a3ac0ad-0f35-d0ee-652d-09bf5af1c3ba@amazon.com> Date: Mon, 12 Sep 2022 09:59:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: Add tracking of backend memory allocated to pg_stat_activity Content-Language: en-US To: Justin Pryzby , Stephen Frost CC: Kyotaro Horiguchi , , References: <67bb5c15c0489cb499723b0340f16e10c22485ec.camel@crunchydata.com> <20220831170555.GW31833@telsasoft.com> <20220901.102820.253548442929111657.horikyota.ntt@gmail.com> <4c6b042a-f79c-29c0-8ce6-f3b13613dcab@amazon.com> <20220909163415.GH26002@tamriel.snowman.net> <20220909170809.GO31833@telsasoft.com> From: "Drouvot, Bertrand" In-Reply-To: <20220909170809.GO31833@telsasoft.com> X-Originating-IP: [10.43.164.249] X-ClientProxiedBy: EX13D09EUC004.ant.amazon.com (10.43.164.115) To EX13D03EUC003.ant.amazon.com (10.43.164.192) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --------------H5EwmvAhDuPq6cxwlkgXQJin Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Hi, On 9/9/22 7:08 PM, Justin Pryzby wrote: > On Fri, Sep 09, 2022 at 12:34:15PM -0400, Stephen Frost wrote: >>> While we are at it, what do you think about also recording the max memory >>> allocated by a backend? (could be useful and would avoid sampling for which >>> there is no guarantee to sample the max anyway). >> What would you do with that information..? By itself, it doesn't strike >> me as useful. Perhaps it'd be interesting to grab the max required for >> a particular query in pg_stat_statements or such but again, that's a >> very different thing. > > Storing the maxrss per backend somewhere would be useful (and avoid the > issue of "sampling" with top), after I agree that it ought to be exposed > to a view. For example, it might help to determine whether (and which!) > backends are using large multiple of work_mem, and then whether that can > be increased. If/when we had a "memory budget allocator", this would > help to determine how to set its GUCs, maybe to see "which backends are > using the work_mem that are precluding this other backend from using > efficient query plan". +1. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services:https://aws.amazon.com --------------H5EwmvAhDuPq6cxwlkgXQJin Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 7bit

Hi,

On 9/9/22 7:08 PM, Justin Pryzby wrote:
On Fri, Sep 09, 2022 at 12:34:15PM -0400, Stephen Frost wrote:
While we are at it, what do you think about also recording the max memory
allocated by a backend? (could be useful and would avoid sampling for which
there is no guarantee to sample the max anyway).

      
What would you do with that information..?  By itself, it doesn't strike
me as useful.  Perhaps it'd be interesting to grab the max required for
a particular query in pg_stat_statements or such but again, that's a
very different thing.

Storing the maxrss per backend somewhere would be useful (and avoid the
issue of "sampling" with top), after I agree that it ought to be exposed
to a view.  For example, it might help to determine whether (and which!)
backends are using large multiple of work_mem, and then whether that can
be increased.  If/when we had a "memory budget allocator", this would
help to determine how to set its GUCs, maybe to see "which backends are
using the work_mem that are precluding this other backend from using
efficient query plan".

+1.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
--------------H5EwmvAhDuPq6cxwlkgXQJin--