Обсуждение: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

Поиск
Список
Период
Сортировка

BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      18343
Logged by:          Christopher Kline
Email address:      kline.christopher@gmail.com
PostgreSQL version: 14.11
Operating system:   Windows 10 x64
Description:

In the default postgresql.conf that is generated, there are the following
lines:

#max_worker_processes = 8        # (change requires restart)
#max_parallel_workers_per_gather = 2    # taken from max_parallel_workers
<<<<<<<<<<<<<<<<<<<<<<<< THIS
#max_parallel_maintenance_workers = 2    # taken from max_parallel_workers
max_parallel_workers = 8        # maximum number of max_worker_processes that
                    # can be used in parallel operations

it indicates that the default value is taken from whatever
max_parallel_workers is. However, if I start postgresql with those settings
and issue a query of 
   SELECT setting, unit FROM pg_settings WHERE name =
'max_parallel_workers_per_gather'

the result I get is '2', not '8'. 

This leads me to believe that either there is a bug in the code that's not
setting the correct default, or the comment in postgresql.conf is incorrect.


PG Bug reporting form <noreply@postgresql.org> writes:
> In the default postgresql.conf that is generated, there are the following
> lines:

> #max_worker_processes = 8        # (change requires restart)
> #max_parallel_workers_per_gather = 2    # taken from max_parallel_workers 
> <<<<<<<<<<<<<<<<<<<<<<<< THIS
> #max_parallel_maintenance_workers = 2    # taken from max_parallel_workers
> max_parallel_workers = 8        # maximum number of max_worker_processes that
>                     # can be used in parallel operations

> it indicates that the default value is taken from whatever
> max_parallel_workers is.

No, you're misreading it.  There's no magic connection between these
two settings.  What the comment means to say is that the per-gather
worker processes come out of a pool of at most max_parallel_workers
processes.  Perhaps another wording would be better, but we don't have
a lot of space here --- any thoughts?

            regards, tom lane



Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

От
"David G. Johnston"
Дата:
On Thu, Feb 15, 2024 at 8:55 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
PG Bug reporting form <noreply@postgresql.org> writes:
> In the default postgresql.conf that is generated, there are the following
> lines:

> #max_worker_processes = 8             # (change requires restart)
> #max_parallel_workers_per_gather = 2  # taken from max_parallel_workers
> <<<<<<<<<<<<<<<<<<<<<<<< THIS
> #max_parallel_maintenance_workers = 2 # taken from max_parallel_workers
> max_parallel_workers = 8              # maximum number of max_worker_processes that
>                                       # can be used in parallel operations

> it indicates that the default value is taken from whatever
> max_parallel_workers is.

No, you're misreading it.  There's no magic connection between these
two settings.  What the comment means to say is that the per-gather
worker processes come out of a pool of at most max_parallel_workers
processes.  Perhaps another wording would be better, but we don't have
a lot of space here --- any thoughts?

max_parallel workers = 8   # allocated from max_worker_processes

max_parallel_*_workers = N  # allocated from max_parallel_workers

or maybe "consumed from ..."

Or

max_parallel_*_workers = N # capped at max_parallel_workers

The last one turns a process-oriented description into a constraint, the latter seems to fit better in a config file.

David J.

Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

От
Christopher Kline
Дата:
Thank you all for the clarification. I like David Johnston's suggestion of

# capped at max_parallel_workers

That clearly defines the constraint.

On Thu, Feb 15, 2024 at 11:10 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Thu, Feb 15, 2024 at 8:55 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
PG Bug reporting form <noreply@postgresql.org> writes:
> In the default postgresql.conf that is generated, there are the following
> lines:

> #max_worker_processes = 8             # (change requires restart)
> #max_parallel_workers_per_gather = 2  # taken from max_parallel_workers
> <<<<<<<<<<<<<<<<<<<<<<<< THIS
> #max_parallel_maintenance_workers = 2 # taken from max_parallel_workers
> max_parallel_workers = 8              # maximum number of max_worker_processes that
>                                       # can be used in parallel operations

> it indicates that the default value is taken from whatever
> max_parallel_workers is.

No, you're misreading it.  There's no magic connection between these
two settings.  What the comment means to say is that the per-gather
worker processes come out of a pool of at most max_parallel_workers
processes.  Perhaps another wording would be better, but we don't have
a lot of space here --- any thoughts?

max_parallel workers = 8   # allocated from max_worker_processes

max_parallel_*_workers = N  # allocated from max_parallel_workers

or maybe "consumed from ..."

Or

max_parallel_*_workers = N # capped at max_parallel_workers

The last one turns a process-oriented description into a constraint, the latter seems to fit better in a config file.

David J.

Christopher Kline <kline.christopher@gmail.com> writes:
> Thank you all for the clarification. I like David Johnston's suggestion of
> # capped at max_parallel_workers
> That clearly defines the constraint.

I was thinking perhaps "# limited by max_parallel_workers"
or something like that.  "Capped at" isn't phraseology we
use elsewhere.

            regards, tom lane



Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

От
"David G. Johnston"
Дата:
On Thu, Feb 15, 2024 at 10:31 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Christopher Kline <kline.christopher@gmail.com> writes:
> Thank you all for the clarification. I like David Johnston's suggestion of
> # capped at max_parallel_workers
> That clearly defines the constraint.

I was thinking perhaps "# limited by max_parallel_workers"
or something like that.  "Capped at" isn't phraseology we
use elsewhere.


"limited by" is indeed better IMO as well.

David J.

Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

От
Christopher Kline
Дата:
Agreed.

On Thu, Feb 15, 2024 at 2:42 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Thu, Feb 15, 2024 at 10:31 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Christopher Kline <kline.christopher@gmail.com> writes:
> Thank you all for the clarification. I like David Johnston's suggestion of
> # capped at max_parallel_workers
> That clearly defines the constraint.

I was thinking perhaps "# limited by max_parallel_workers"
or something like that.  "Capped at" isn't phraseology we
use elsewhere.


"limited by" is indeed better IMO as well.

David J.
Christopher Kline <kline.christopher@gmail.com> writes:
> On Thu, Feb 15, 2024 at 2:42 PM David G. Johnston <
> david.g.johnston@gmail.com> wrote:
>> "limited by" is indeed better IMO as well.

> Agreed.

Sold, I'll make it so.

            regards, tom lane