Re: Proposal: Adding isbgworker column to pg_stat_activity

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Paul Martinez <paulmtz(at)google(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal: Adding isbgworker column to pg_stat_activity
Date: 2022-10-25 08:33:31
Message-ID: 20221025083331.n5ytph3z7agy4vtb@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


I just noticed that this proposal from 2020 didn't get any backers:

On 2020-Dec-01, Paul Martinez wrote:

> It is currently slightly difficult to determine how many background worker
> processes are currently running, which is useful when trying to manage
> the max_worker_processes parameter. It seems the best bet is to use the
> backend_type column and filter out the many types that are defined in
> miscinit.c:
> I would like to propose adding a simple column isbgworker, that simply
> stores the value of the expression `beentry->st_backendType == B_BG_WORKER`,
> which is used in pg_stat_get_activity.

Having recently had the chance to interact with this --and not at all
happy about how it went-- I think we should do this, or something like
it. It should be easy to filter out or in processes which correspond to
bgworkers in pg_stat_activity. One simple idea would be to prefix
something to backend_type (IIRC we used to do that), but a separate flag
is probably more appropriate.

Are you up for writing a patch? I'm guessing it should be easy.

Álvaro Herrera PostgreSQL Developer —
"Puedes vivir sólo una vez, pero si lo haces bien, una vez es suficiente"

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Japin Li 2022-10-25 09:02:25 Confused about TransactionIdSetTreeStatus
Previous Message Richard Guo 2022-10-25 07:56:33 Re: fixing typo in comment for restriction_is_or_clause