Re: Workers in Postgres

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Teja Jakkidi <teja(dot)jakkidi05(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Workers in Postgres
Date: 2022-07-26 02:37:10
Message-ID: CAKFQuwYRx+VzhrJL8XDv=_ificKuu81+1VQb6M-HQwZSF1xY7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, Jul 25, 2022 at 5:20 PM Teja Jakkidi <teja(dot)jakkidi05(at)gmail(dot)com>
wrote:

> Hello Admin team,
>
> I am new to Postgres and please excuse me if these are silly questions:
>
> 1. What is a worker process exactly in Postgres?
> 2. is max_parallel_workers specific to a session or instance. My
> max_parallel_workers is set to 8. If it is specific to instance, does it
> mean at any point of time I can only see 8 parallel processes despite the
> number of transactions in the db?
> 3. Does number of worker process have anything to do with active
> connections to the database.
>
> I have read the documentation but unable to catch up correctly. Any help
> from you is appreciated.
>
>
I agree that some improvement here seems warranted. At minimum the setting
description should be linking to the main documentation for the feature:

https://www.postgresql.org/docs/current/bgworker.html

Plus, that chapter seems to only think that these workers are going to be
interacted with by people writing custom code, not those wishing to manage
a limited system resource in the face of parallelism.

However, the second question is answered by looking at what
max_worker_processes say:

"Sets the maximum number of background processes that the system can
support."
and
"This parameter can only be set at server start."

Any per-session parameter would usually be changeable within a given
session. This one is a DBA setting to say how many resources are to be
consumed by the server.

The nature of the background worker's task determines whether it consumes
an available connection slot. Parallel workers do not as the leader
process already has one assigned to it for the team. See the first link.

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2022-07-26 02:44:48 Re: Workers in Postgres
Previous Message Teja Jakkidi 2022-07-26 00:20:08 Workers in Postgres