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

Started by PG Bug reporting formabout 2 years ago8 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

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.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

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

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Tom Lane (#2)
Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

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.

#4Christopher Kline
kline.christopher@gmail.com
In reply to: David G. Johnston (#3)
Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

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:

Show quoted text

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.

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Christopher Kline (#4)
Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

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

#6David G. Johnston
david.g.johnston@gmail.com
In reply to: Tom Lane (#5)
Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

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.

#7Christopher Kline
kline.christopher@gmail.com
In reply to: David G. Johnston (#6)
Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

Agreed.

On Thu, Feb 15, 2024 at 2:42 PM David G. Johnston <
david.g.johnston@gmail.com> wrote:

Show quoted text

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.

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Christopher Kline (#7)
Re: BUG #18343: Incorrect description in postgresql.conf for max_parallel_workers_per_gather

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