Re: POC: Parallel processing of indexes in autovacuum

From: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
To: Daniil Davydov <3danissimo(at)gmail(dot)com>
Cc: Sami Imseih <samimseih(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Maxim Orlov <orlovmg(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: POC: Parallel processing of indexes in autovacuum
Date: 2025-05-15 21:06:19
Message-ID: CAFY6G8cJ=DRTX75pOGerH6sk39dRt+7MSH+y_qppDdhPs=qdQA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 09/05/25 15:33, Daniil Davydov wrote:
> Hi,
> As I promised - meet parallel index autovacuum with bgworkers
> (Parallel-index-autovacuum-with-bgworkers.patch). This is pretty
> simple implementation :
> 1) Added new table option `parallel_idx_autovac_enabled` that must be
> set to `true` if user wants autovacuum to process table in parallel.
> 2) Added new GUC variable `autovacuum_reserved_workers_num`. This is
> number of parallel workers from bgworkers pool that can be used only
> by autovacuum workers. The `autovacuum_reserved_workers_num` parameter
> actually reserves a requested part of the processes, the total number
> of which is equal to `max_worker_processes`.
> 3) When an autovacuum worker decides to process some table in
> parallel, it just sets `VacuumParams->nworkers` to appropriate value
> (> 0) and then the code is executed as if it were a regular VACUUM
> PARALLEL.
> 4) I kept test/modules/autovacuum as sandbox where you can play with
> parallel index autovacuum a bit.
>
> What do you think about this implementation?
>
I've reviewed the v1-0001 patch, the build on MacOS using meson+ninja is
failing:
❯❯❯ ninja -C build install
ninja: Entering directory `build'
[1/126] Compiling C object
src/backend/postgres_lib.a.p/utils_misc_guc_tables.c.o
FAILED: src/backend/postgres_lib.a.p/utils_misc_guc_tables.c.o
../src/backend/utils/misc/guc_tables.c:3613:4: error: incompatible
pointer to integer conversion initializing 'int' with an expression of
type 'void *' [-Wint-conversion]
3613 | NULL,
| ^~~~

It seems that the "autovacuum_reserved_workers_num" declaration on
guc_tables.c has an extra gettext_noop() call?

One other point is that as you've added TAP tests for the autovacuum I
think you also need to create a meson.build file as you already create
the Makefile.

You also need to update the src/test/modules/meson.build and
src/test/modules/Makefile to include the new test/modules/autovacuum
path.

--
Matheus Alcantara

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2025-05-15 23:59:36 Re: Proposal: Filter irrelevant change before reassemble transactions during logical decoding
Previous Message Álvaro Herrera 2025-05-15 18:02:02 Re: PG 18 release notes draft committed