Re: Proposal: Adding isbgworker column to pg_stat_activity - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Proposal: Adding isbgworker column to pg_stat_activity
Date
Msg-id 20221025083331.n5ytph3z7agy4vtb@alvherre.pgsql
Whole thread Raw
In response to Proposal: Adding isbgworker column to pg_stat_activity  (Paul Martinez <paulmtz@google.com>)
List pgsql-hackers
Hello,

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:
> 
> https://github.com/postgres/postgres/blob/REL_13_1/src/backend/utils/init/miscinit.c#L201-L253
> 
> 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  —  https://www.EnterpriseDB.com/
"Puedes vivir sólo una vez, pero si lo haces bien, una vez es suficiente"



pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: fixing typo in comment for restriction_is_or_clause
Next
From: Japin Li
Date:
Subject: Confused about TransactionIdSetTreeStatus