From: | "Matheus Alcantara" <matheusssilv97(at)gmail(dot)com> |
---|---|
To: | "Daniil Davydov" <3danissimo(at)gmail(dot)com> |
Cc: | "Masahiko Sawada" <sawada(dot)mshk(at)gmail(dot)com>, "Sami Imseih" <samimseih(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-07-08 15:20:54 |
Message-ID: | DB6RXKXU3S74.3G30BD2UD8I8E@gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun Jul 6, 2025 at 5:00 AM -03, Daniil Davydov wrote:
>> The "autovacuum_max_parallel_workers" declared on guc_tables.c mention
>> that is capped by "max_worker_process":
>> + {
>> + {"autovacuum_max_parallel_workers", PGC_SIGHUP, VACUUM_AUTOVACUUM,
>> + gettext_noop("Maximum number of parallel autovacuum workers, that can be taken from bgworkers pool."),
>> + gettext_noop("This parameter is capped by \"max_worker_processes\" (not by \"autovacuum_max_workers\"!)."),
>> + },
>> + &autovacuum_max_parallel_workers,
>> + 0, 0, MAX_BACKENDS,
>> + check_autovacuum_max_parallel_workers, NULL, NULL
>> + },
>>
>> IIUC the code, it cap by "max_worker_process", but Masahiko has mention
>> on [1] that it should be capped by max_parallel_workers.
> To be honest, I don't think that this parameter should be explicitly
> capped at all.
> Other parallel operations (for example parallel index build or VACUUM
> PARALLEL) just request as many workers as they want without looking at
> 'max_parallel_workers'.
> And they will not complain, if not all requested workers were launched.
>
> Thus, even if 'autovacuum_max_parallel_workers' is higher than
> 'max_parallel_workers' the worst that can happen is that not all
> requested workers will be running (which is a common situation).
> Users can handle it by looking for logs like "planned vs. launched"
> and increasing 'max_parallel_workers' if needed.
>
> On the other hand, obviously it doesn't make sense to request more
> workers than 'max_worker_processes' (moreover, this parameter cannot
> be changed as easily as 'max_parallel_workers').
>
> I will keep the 'max_worker_processes' limit, so autovacuum will not
> waste time initializing a parallel context if there is no chance that
> the request will succeed.
> But it's worth remembering that actually the
> 'autovacuum_max_parallel_workers' parameter will always be implicitly
> capped by 'max_parallel_workers'.
>
> What do you think about it?
>
It make sense to me. The main benefit that I see on capping
autovacuum_max_parallel_workers parameter is that users will see
"invalid value for parameter "autovacuum_max_parallel_workers"" error on
logs instead of need to search for "planned vs. launched", which can be
trick if log_min_messages is not set to at least the info level (the
default warning level will not show this log message). If we decide to
not cap this on code I think that at least would be good to mention this
on documentation.
>>
>> I've made some tests and I can confirm that is working correctly for
>> what I can see. I think that would be to start include the documentation
>> changes, what do you think?
>>
>
> It sounds tempting :)
> But perhaps first we should agree on the limitation of the
> 'autovacuum_max_parallel_workers' parameter.
>
Agree
> Please, see v6 patches :
> 1) Fixed typos in autovacuum.c and postgresql.conf.sample
> 2) Removed unused macro 'RelationGetParallelAutovacuumWorkers'
>
Thanks!
--
Matheus Alcantara
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2025-07-08 15:21:20 | Re: Can can I make an injection point wait occur no more than once? |
Previous Message | Mircea Cadariu | 2025-07-08 14:47:34 | Re: Add os_page_num to pg_buffercache |