Re: Add tracking of backend memory allocated to pg_stat_activity

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: reid(dot)thompson(at)crunchydata(dot)com
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add tracking of backend memory allocated to pg_stat_activity
Date: 2022-09-01 04:43:20
Message-ID: 20220901.134320.188875425242927802.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Wed, 31 Aug 2022 12:03:06 -0400, Reid Thompson <reid(dot)thompson(at)crunchydata(dot)com> wrote in
> Attached is a patch to
> Add tracking of backend memory allocated to pg_stat_activity

> @@ -916,6 +930,7 @@ AllocSetAlloc(MemoryContext context, Size size)
> return NULL;
>
> context->mem_allocated += blksize;
> + pgstat_report_backend_mem_allocated_increase(blksize);

I'm not sure this is acceptable. The function adds a branch even when
the feature is turned off, which I think may cause a certain extent of
performance degradation. A past threads [1], [2] and [3] might be
informative.

[1] https://www.postgresql.org/message-id/1434311039.4369.39.camel%40jeff-desktop
[2] https://www.postgresql.org/message-id/72a656e0f71d0860161e0b3f67e4d771%40oss.nttdata.com
[3] https://www.postgresql.org/message-id/0271f440ac77f2a4180e0e56ebd944d1%40oss.nttdata.com

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-09-01 04:47:53 Re: pg15b3: recovery fails with wal prefetch enabled
Previous Message Michael Paquier 2022-09-01 04:41:59 Re: [PATCH] Add native windows on arm64 support