Re: POC: Parallel processing of indexes in autovacuum
Daniil Davydov <3danissimo@gmail.com>
From: Daniil Davydov <3danissimo@gmail.com>
To: Sami Imseih <samimseih@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, Maxim Orlov <orlovmg@gmail.com>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-05-09T18:33:45Z
Lists: pgsql-hackers
Attachments
- v1-0001-Parallel-index-autovacuum-with-bgworkers.patch (text/x-patch) patch v1-0001
- v3-0001-Self-managed-parallel-index-autovacuum.patch (text/x-patch) patch v3-0001
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? P.S. I also improved "self-managed" parallel autovacuum implementation (Self-managed-parallel-index-autovacuum.patch). For now it needs a lot of refactoring, but all features are working good. Both patches are targeting on master branch (bc35adee8d7ad38e7bef40052f196be55decddec) -- Best regards, Daniil Davydov
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