Re: Workers in Postgres

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Workers in Postgres
Дата
Msg-id 2122536.1658803488@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Workers in Postgres  (Teja Jakkidi <teja.jakkidi05@gmail.com>)
Список pgsql-admin
Teja Jakkidi <teja.jakkidi05@gmail.com> writes:
> 1. What is a worker process exactly in Postgres?

It's a background process that can be started if the planner decides
that a particular query would benefit from parallelization.  If so,
the original session process (the "leader") cooperates with one or
more temporarily-spawned workers to perform the query.

> 2. is max_parallel_workers specific to a session or instance. My max_parallel_workers is set to 8. If it is specific
toinstance, does it mean at any point of time I can only see 8 parallel processes despite the number of transactions in
thedb?  

Per instance.  There is a different knob max_parallel_workers_per_gather
that gives you some control over how many workers a given leader will
try to use.

Before you say "oh, I've got max_connections set to 100, so I'd better
raise max_parallel_workers to a few hundred" ... don't do that unless
you've got a few hundred CPUs in the machine.  While session processes
might be sitting around doing nothing much except waiting for the next
query, workers generally are busy throughout their lifespan.  So it's
counterproductive for max_parallel_workers to be more than roughly the
number of available CPUs --- setting it higher just encourages the
system to create parallel workers that it can't use effectively.

> 3. Does number of worker process have anything to do with active connections to the database.

See above.

            regards, tom lane



В списке pgsql-admin по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Workers in Postgres
Следующее
От: abbas alizadeh
Дата:
Сообщение: Segmentation fault