On Thu, May 13, 2021 at 7:00 PM Masahiko Sawada <sawada.m...@gmail.com> wrote: > > > Yeah, I get it. Even if users don't specify a parallel option there > > > are chances that parallelism is picked. So the parallel degree is the > > > final number of workers that are chosen by the server for vacuuming > > > indexes. And, I think that parallel degree is something internal to > > > the server, and it's better we replace it in the vacuumdb.sgml, change > > > PARALLEL_DEGREE to PARALLEL_WORKERS in vacuumdb.c and change the error > > > message "parallel vacuum degree must be a non-negative integer" to > > > "parallel workers for vacuum must be greater than or equal to zero". > > > > > > Thoughts? > > I'm fine with this change.
Thanks. > is important here but another idea to improve the error message would > be to change "parallel vacuum degree must be between 0 and %d” to "the > number of parallel workers must be between 0 and %d” (or using > “parallel workers for vacuum” instead of “the number of parallel > workers”) while leaving another message as it is. Done that way. PSA patch. With Regards, Bharath Rupireddy. EnterpriseDB: http://www.enterprisedb.com
From 514128927d51a5b0578e9b1ce969a68fe8d62b1c Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy <bharath.rupireddy@enterprisedb.com> Date: Thu, 13 May 2021 20:29:38 +0530 Subject: [PATCH v1] Parallel Vacuum-Reword Error Messages and Docs --- doc/src/sgml/ref/vacuumdb.sgml | 2 +- src/backend/commands/vacuum.c | 2 +- src/bin/scripts/vacuumdb.c | 4 ++-- src/test/regress/expected/vacuum.out | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/src/sgml/ref/vacuumdb.sgml b/doc/src/sgml/ref/vacuumdb.sgml index 843a82e871..05249c4772 100644 --- a/doc/src/sgml/ref/vacuumdb.sgml +++ b/doc/src/sgml/ref/vacuumdb.sgml @@ -279,7 +279,7 @@ PostgreSQL documentation <term><option>--parallel=<replaceable class="parameter">parallel_degree</replaceable></option></term> <listitem> <para> - Specify the parallel degree of <firstterm>parallel vacuum</firstterm>. + Specify the number of parallel workers for <firstterm>parallel vacuum</firstterm>. This allows the vacuum to leverage multiple CPUs to process indexes. See <xref linkend="sql-vacuum"/>. </para> diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index d549d0d86f..7421d7cfbd 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -165,7 +165,7 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel) if (nworkers < 0 || nworkers > MAX_PARALLEL_WORKER_LIMIT) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("parallel vacuum degree must be between 0 and %d", + errmsg("parallel workers for vacuum must be between 0 and %d", MAX_PARALLEL_WORKER_LIMIT), parser_errposition(pstate, opt->location))); diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 7901c41f16..069a861aab 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -200,7 +200,7 @@ main(int argc, char *argv[]) vacopts.parallel_workers = atoi(optarg); if (vacopts.parallel_workers < 0) { - pg_log_error("parallel vacuum degree must be a non-negative integer"); + pg_log_error("parallel workers for vacuum must be greater than or equal to zero"); exit(1); } break; @@ -1000,7 +1000,7 @@ help(const char *progname) printf(_(" --no-index-cleanup don't remove index entries that point to dead tuples\n")); printf(_(" --no-process-toast skip the TOAST table associated with the table to vacuum\n")); printf(_(" --no-truncate don't truncate empty pages at the end of the table\n")); - printf(_(" -P, --parallel=PARALLEL_DEGREE use this many background workers for vacuum, if available\n")); + printf(_(" -P, --parallel=PARALLEL_WORKERS use this many background workers for vacuum, if available\n")); printf(_(" -q, --quiet don't write any messages\n")); printf(_(" --skip-locked skip relations that cannot be immediately locked\n")); printf(_(" -t, --table='TABLE[(COLUMNS)]' vacuum specific table(s) only\n")); diff --git a/src/test/regress/expected/vacuum.out b/src/test/regress/expected/vacuum.out index 90cea6caa8..5e657849aa 100644 --- a/src/test/regress/expected/vacuum.out +++ b/src/test/regress/expected/vacuum.out @@ -110,7 +110,7 @@ VACUUM (PARALLEL 2) pvactst; UPDATE pvactst SET i = i WHERE i < 1000; VACUUM (PARALLEL 0) pvactst; -- disable parallel vacuum VACUUM (PARALLEL -1) pvactst; -- error -ERROR: parallel vacuum degree must be between 0 and 1024 +ERROR: parallel workers for vacuum must be between 0 and 1024 LINE 1: VACUUM (PARALLEL -1) pvactst; ^ VACUUM (PARALLEL 2, INDEX_CLEANUP FALSE) pvactst; -- 2.25.1