Re: POC: Parallel processing of indexes in autovacuum
Sami Imseih <samimseih@gmail.com>
From: Sami Imseih <samimseih@gmail.com>
To: Daniil Davydov <3danissimo@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>,
Alexander Korotkov <aekorotkov@gmail.com>, Matheus Alcantara <matheusssilv97@gmail.com>,
Maxim Orlov <orlovmg@gmail.com>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-22T22:51:42Z
Lists: pgsql-hackers
> > nworkers has a double meaning. The return value of
> > AutoVacuumReserveParallelWorkers
> > is nreserved. I think this should be
> >
> > ```
> > nreserved = AutoVacuumReserveParallelWorkers(nworkers);
> > ```
> >
> > and nreserved becomes the authoritative value for the number of parallel
> > workers after that point.
I could not find this pattern being used in the code base.
I think it will be better and more in-line without what we generally do
and pass-by-reference and update the value inside
AutoVacuumReserveParallelWorkers:
```
AutoVacuumReserveParallelWorkers(&nworkers).
```
Maybe that's just my preference.
>> ---
>> { name => 'autovacuum_max_parallel_workers', type => 'int', context =>
>> 'PGC_SIGHUP', group => 'VACUUM_AUTOVACUUM',
>> short_desc => 'Maximum number of parallel autovacuum workers, that
>> can be taken from bgworkers pool.',
>> long_desc => 'This parameter is capped by "max_worker_processes"
>> (not by "autovacuum_max_workers"!).',
>> variable => 'autovacuum_max_parallel_workers',
>> boot_val => '0',
>> min => '0',
>> max => 'MAX_BACKENDS',
>> },
>>
>> Parallel vacuum in autovacuum can be used only when users set the
>> autovacuum_parallel_workers storage parameter. How about using the
>> default value 2 for autovacuum_max_parallel_workers GUC parameter?
> Sounds reasonable, +1 for it.
v15-0004 has an incorrect default value for `autovacuum_max_parallel_workers`.
It should now be 2.
+ Sets the maximum number of parallel autovacuum workers that
+ can be used for parallel index vacuuming at one time. Is capped by
+ <xref linkend="guc-max-worker-processes"/>. The default is 0,
+ which means no parallel index vacuuming.
--
Sami
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Allow autovacuum to use parallel vacuum workers.
- 1ff3180ca016 19 (unreleased) landed
-
Add parallel vacuum worker usage to VACUUM (VERBOSE) and autovacuum logs.
- adcdbe93860b 19 (unreleased) landed
-
doc: Put new options in consistent order on man pages
- bc35adee8d7a 18.0 cited