Re: parallel vacuum - few questions on docs, comments and code

Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>

From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Amit Kapila <amit.kapila16@gmail.com>
Date: 2021-05-12T12:58:05Z
Lists: pgsql-hackers
On Tue, May 11, 2021 at 6:31 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
> > 4) IIUC, below comment says that even if PARALLEL 0 is specified with
> > VACUUM command, there are chances that the indexes are vacuumed in
> > parallel. Isn't it a bit unusual that a user specified 0 workers but
> > still the system is picking up parallelism? I'm sure this would have
> > been discussed, but I'm curious to know the reason.
> >  * nrequested is the number of parallel workers that user requested.  If
> >  * nrequested is 0, we compute the parallel degree based on nindexes, that is
> >  * the number of indexes that support parallel vacuum.
>
> No - nrequested is not actually the number of workers requested - it seems like
> a poor choice of name.
>
> This is the key part:
>
> src/include/commands/vacuum.h
>          * The number of parallel vacuum workers.  0 by default which means choose
>          * based on the number of indexes.  -1 indicates parallel vacuum is
>          * disabled.
>          */
>         int                     nworkers;
> } VacuumParams;

Thanks. The name "nworkers" looks fine to me after reading the comment
above it.  And the parallelism will be chosen by default.
    /* By default parallel vacuum is enabled */
    params.nworkers = 0;

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com



Commits

  1. Improve docs and error messages for parallel vacuum.