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

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: parallel vacuum - few questions on docs, comments and code
Date: 2021-05-11 13:01:47
Message-ID: 20210511130147.GG27406@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 11, 2021 at 05:37:50PM +0530, Bharath Rupireddy wrote:
> 3) Should the Assert(nindexes > 0); in begin_parallel_vacuum just be
> Assert(nindexes > 1); as this function is entered only when indexes
> are > 1?

I think you're right, at least with the current implementation that
parallelization is done across indexes. Same in parallel_vacuum_main.

> 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;

The parsing code is in src/backend/commands/vacuum.c.

> 8) Is it still true that if parallel workers are specified as 0 the
> parallelism will not be picked up?
> From the docs: This feature is known as parallel vacuum. To disable
> this feature, one can use PARALLEL option and specify parallel workers
> as zero.

I think it's the same answer as above.

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan S. Katz 2021-05-11 13:13:31 Re: PG 14 release notes, first draft
Previous Message Amit Langote 2021-05-11 12:53:24 Re: Inherited UPDATE/DELETE vs async execution