Re: allow changing autovacuum_max_workers without restarting

2024-05-16 Thread Nathan Bossart
On Thu, May 16, 2024 at 04:37:10PM +, Imseih (AWS), Sami wrote: > I thought 256 was a good enough limit. In practice, I doubt anyone will > benefit from more than a few dozen autovacuum workers. > I think 1024 is way too high to even allow. WFM > I don't think combining 1024 + 5 = 1029 is

Re: allow changing autovacuum_max_workers without restarting

2024-05-16 Thread Imseih (AWS), Sami
>>> That's true, but using a hard-coded limit means we no longer need to add a >>> new GUC. Always allocating, say, 256 slots might require a few additional >>> kilobytes of shared memory, most of which will go unused, but that seems >>> unlikely to be a problem for the systems that will run

Re: allow changing autovacuum_max_workers without restarting

2024-05-07 Thread Nathan Bossart
zon Web Services: https://aws.amazon.com >From 72e0496294ef0390c77cef8031ae51c1a44ebde8 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Tue, 7 May 2024 10:59:24 -0500 Subject: [PATCH v3 1/1] allow changing autovacuum_max_workers without restarting --- doc/src/sgml/config.sgml

Re: allow changing autovacuum_max_workers without restarting

2024-05-03 Thread Imseih (AWS), Sami
> That's true, but using a hard-coded limit means we no longer need to add a > new GUC. Always allocating, say, 256 slots might require a few additional > kilobytes of shared memory, most of which will go unused, but that seems > unlikely to be a problem for the systems that will run Postgres v18.

Re: allow changing autovacuum_max_workers without restarting

2024-05-02 Thread Nathan Bossart
On Mon, Apr 15, 2024 at 05:41:04PM +, Imseih (AWS), Sami wrote: >> Another option could be to just remove the restart-only GUC and hard-code >> the upper limit of autovacuum_max_workers to 64 or 128 or something. While >> that would simplify matters, I suspect it would be hard to choose an >>

Re: allow changing autovacuum_max_workers without restarting

2024-04-22 Thread Robert Haas
On Fri, Apr 19, 2024 at 4:29 PM Nathan Bossart wrote: > I certainly don't want to hold up $SUBJECT for a larger rewrite of > autovacuum scheduling, but I also don't want to shy away from a larger > rewrite if it's an idea whose time has come. I'm looking forward to > hearing your ideas in your

Re: allow changing autovacuum_max_workers without restarting

2024-04-21 Thread Imseih (AWS), Sami
> Part of the underlying problem here is that, AFAIK, neither PostgreSQL > as a piece of software nor we as human beings who operate PostgreSQL > databases have much understanding of how autovacuum_max_workers should > be set. It's relatively easy to hose yourself by raising >

Re: allow changing autovacuum_max_workers without restarting

2024-04-19 Thread Nathan Bossart
On Fri, Apr 19, 2024 at 02:42:13PM -0400, Robert Haas wrote: > I think this could help a bunch of users, but I'd still like to > complain, not so much with the desire to kill this patch as with the > desire to broaden the conversation. I think I subconsciously hoped this would spark a bigger

Re: allow changing autovacuum_max_workers without restarting

2024-04-19 Thread Robert Haas
On Fri, Apr 19, 2024 at 11:43 AM Nathan Bossart wrote: > Removed in v2. I also noticed that I forgot to update the part about when > autovacuum_max_workers can be changed. *facepalm* I think this could help a bunch of users, but I'd still like to complain, not so much with the desire to kill

Re: allow changing autovacuum_max_workers without restarting

2024-04-19 Thread Nathan Bossart
On Thu, Apr 18, 2024 at 05:05:03AM +, Imseih (AWS), Sami wrote: > I looked at the patch set. With the help of DEBUG2 output, I tested to ensure > that the the autovacuum_cost_limit balance adjusts correctly when the > autovacuum_max_workers value increases/decreases. I did not think the >

Re: allow changing autovacuum_max_workers without restarting

2024-04-17 Thread Imseih (AWS), Sami
> Here is a first attempt at a proper patch set based on the discussion thus > far. I've split it up into several small patches for ease of review, which > is probably a bit excessive. If this ever makes it to commit, they could > likely be combined. I looked at the patch set. With the help of

Re: allow changing autovacuum_max_workers without restarting

2024-04-17 Thread wenhui qiu
Agree +1,From a dba perspective, I would prefer that this parameter can be dynamically modified, rather than adding a new parameter,What is more difficult is how to smoothly reach the target value when the setting is considered to be too large and needs to be lowered. Regards On Tue, 16 Apr

Re: allow changing autovacuum_max_workers without restarting

2024-04-15 Thread Imseih (AWS), Sami
> Another option could be to just remove the restart-only GUC and hard-code > the upper limit of autovacuum_max_workers to 64 or 128 or something. While > that would simplify matters, I suspect it would be hard to choose an > appropriate limit that won't quickly become outdated. Hardcoded values

Re: allow changing autovacuum_max_workers without restarting

2024-04-15 Thread Nathan Bossart
On Mon, Apr 15, 2024 at 11:28:33AM -0500, Nathan Bossart wrote: > On Mon, Apr 15, 2024 at 08:33:33AM -0500, Justin Pryzby wrote: >> On Wed, Apr 10, 2024 at 04:23:44PM -0500, Nathan Bossart wrote: >>> The proof-of-concept patch keeps autovacuum_max_workers as the maximum >>> number of slots to

Re: allow changing autovacuum_max_workers without restarting

2024-04-15 Thread Nathan Bossart
On Mon, Apr 15, 2024 at 08:33:33AM -0500, Justin Pryzby wrote: > On Wed, Apr 10, 2024 at 04:23:44PM -0500, Nathan Bossart wrote: >> The proof-of-concept patch keeps autovacuum_max_workers as the maximum >> number of slots to reserve for workers, but I think we should instead >> rename this

Re: allow changing autovacuum_max_workers without restarting

2024-04-15 Thread Justin Pryzby
On Wed, Apr 10, 2024 at 04:23:44PM -0500, Nathan Bossart wrote: > The attached proof-of-concept patch demonstrates what I have in mind. > Instead of trying to dynamically change the global process table, etc., I'm > proposing that we introduce a new GUC that sets the effective maximum > number of

Re: allow changing autovacuum_max_workers without restarting

2024-04-14 Thread Nathan Bossart
Here is a first attempt at a proper patch set based on the discussion thus far. I've split it up into several small patches for ease of review, which is probably a bit excessive. If this ever makes it to commit, they could likely be combined. -- Nathan Bossart Amazon Web Services:

Re: allow changing autovacuum_max_workers without restarting

2024-04-13 Thread Imseih (AWS), Sami
> IIRC using GUC hooks to handle dependencies like this is generally frowned > upon because it tends to not work very well [0]. We could probably get it > to work for this particular case, but IMHO we should still try to avoid > this approach. Thanks for pointing this out. I agree, this could

Re: allow changing autovacuum_max_workers without restarting

2024-04-13 Thread Nathan Bossart
On Fri, Apr 12, 2024 at 10:17:44PM +, Imseih (AWS), Sami wrote: >>> Hm. Maybe the autovacuum launcher could do that. > > Would it be better to use a GUC check_hook that compares the > new value with the max allowed values and emits a WARNING ? > > autovacuum_max_workers already has a

Re: allow changing autovacuum_max_workers without restarting

2024-04-12 Thread Imseih (AWS), Sami
>> 1/ We should emit a log when autovacuum_workers is set higher than the max. >> Hm. Maybe the autovacuum launcher could do that. Would it be better to use a GUC check_hook that compares the new value with the max allowed values and emits a WARNING ? autovacuum_max_workers already has a

Re: allow changing autovacuum_max_workers without restarting

2024-04-12 Thread Nathan Bossart
On Fri, Apr 12, 2024 at 05:27:40PM +, Imseih (AWS), Sami wrote: > A few comments on the POC patch: Thanks for reviewing. > 1/ We should emit a log when autovacuum_workers is set higher than the max. Hm. Maybe the autovacuum launcher could do that. > 2/ should the name of the restart

Re: allow changing autovacuum_max_workers without restarting

2024-04-12 Thread Imseih (AWS), Sami
I spent sometime reviewing/testing the POC. It is relatively simple with a lot of obvious value. I tested with 16 tables that constantly reach the autovac threashold and the patch did the right thing. I observed concurrent autovacuum workers matching the setting as I was adjusting it

Re: allow changing autovacuum_max_workers without restarting

2024-04-11 Thread Nathan Bossart
On Thu, Apr 11, 2024 at 03:37:23PM +, Imseih (AWS), Sami wrote: >> My concern with this approach is that other background workers could use up >> all the slots and prevent autovacuum workers from starting > > That's a good point, the current settings do not guarantee that you > get a worker

Re: allow changing autovacuum_max_workers without restarting

2024-04-11 Thread Imseih (AWS), Sami
> My concern with this approach is that other background workers could use up > all the slots and prevent autovacuum workers from starting That's a good point, the current settings do not guarantee that you get a worker for the purpose if none are available, i.e. max_parallel_workers_per_gather,

Re: allow changing autovacuum_max_workers without restarting

2024-04-11 Thread Nathan Bossart
On Thu, Apr 11, 2024 at 09:42:40AM -0500, Nathan Bossart wrote: > On Thu, Apr 11, 2024 at 02:24:18PM +, Imseih (AWS), Sami wrote: >> max_worker_processes defines a pool of max # of background workers allowed. >> parallel workers and extensions that spin up background workers all utilize >>

Re: allow changing autovacuum_max_workers without restarting

2024-04-11 Thread Nathan Bossart
On Thu, Apr 11, 2024 at 02:24:18PM +, Imseih (AWS), Sami wrote: > max_worker_processes defines a pool of max # of background workers allowed. > parallel workers and extensions that spin up background workers all utilize > from > this pool. > > Should autovacuum_max_workers be able to

Re: allow changing autovacuum_max_workers without restarting

2024-04-11 Thread Imseih (AWS), Sami
> I frequently hear about scenarios where users with thousands upon thousands > of tables realize that autovacuum is struggling to keep up. When they > inevitably go to bump up autovacuum_max_workers, they discover that it > requires a server restart (i.e., downtime) to take effect, causing

allow changing autovacuum_max_workers without restarting

2024-04-10 Thread Nathan Bossart
I frequently hear about scenarios where users with thousands upon thousands of tables realize that autovacuum is struggling to keep up. When they inevitably go to bump up autovacuum_max_workers, they discover that it requires a server restart (i.e., downtime) to take effect, causing further