Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pkTG7-0001ra-Vf for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Apr 2023 17:18:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pkTG6-00016s-Rp for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Apr 2023 17:18:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pkTG6-00016j-I8 for pgsql-hackers@lists.postgresql.org; Thu, 06 Apr 2023 17:18:50 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pkTG4-0002r3-4F for pgsql-hackers@postgresql.org; Thu, 06 Apr 2023 17:18:49 +0000 Received: by mail-lf1-x130.google.com with SMTP id d7so6729326lfj.3 for ; Thu, 06 Apr 2023 10:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680801526; x=1683393526; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=d3Y0F7NdJ326UKsPSeq6kAS5K1P2mnJZvZshDWFqZy0=; b=mp7otFnMFiYVMFZtJ2kN7UOq47BQW/bnOq25CGFo/jg/AfF2JqyGDf33cDj7ntwaoX vzv4U1VtScTYZ4wizq5R9PeF+EaPulozCTFEjjSD7bqjIZCnTgYsKU/5sAdUG7HJJ3u5 x4a/8Ommu9gbRB85fJfP3XqO+8+t2iJ6FYa0YuQAVWUFZmDfG0B4MlrwI1f0xDWMfAe4 ytmRXCs3JERJqhd6y884UaojgYIksrJQbKi1msZXcVnF8YpczAO/BlQlazP3NLOEsuIU hbcemoHCln129GwiUasiELPTL3EEA8uSG646F9kdHwSLLmrUODqlzDfK7G/4Fl/Xm2zQ UhWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680801526; x=1683393526; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d3Y0F7NdJ326UKsPSeq6kAS5K1P2mnJZvZshDWFqZy0=; b=X3qHRRmr3gpxFHKHuAssyQXXPpLupjE4h4+cu6zs56Q3/YCDmEDkjWezHbuWhmnCxi 2svcwEh+Hf4B+QX2L9gcJhdOZWfC/K1zEdk7iK/H9AbrxVsyyVNkiu1lN0BpztWel0mN ftub2v/e3qHFYi2N6yOKabBk7XgFjO9BXL9El/IS8vMu8Vz80i2GBuO9Ct0PWT43AkT5 FBu+XKIN6bnELBtAMraVK+V8L47egRoKxymoumk5QKHFYxbSsWOWz4YWAtd5Ls369UMT ERTZjowycgOE6BHm/6GxOcOivWK0ifeR51V1G0LkUZQVhhpOCElM8Dw3d5TJayEG1T7T 00kg== X-Gm-Message-State: AAQBX9dhNIlQONBIh/QsjDtv5EGzH33XE85ApCw2Du5syi7mIgF2VY/Y JAKqboNrHh6Dxhdr7gAVuccFxMXLLEKoG0R2v0k= X-Google-Smtp-Source: AKy350Zx8wbYtONy9lL/jD5AvqTU4FG/LVdmxjZXq10kM1f2Rwot3yK9l39M04eiGMdcGF2Z4rU3OmCIX7/86UhzP8w= X-Received: by 2002:ac2:54ab:0:b0:4e8:3ef8:8b5c with SMTP id w11-20020ac254ab000000b004e83ef88b5cmr366lfk.8.1680801526379; Thu, 06 Apr 2023 10:18:46 -0700 (PDT) MIME-Version: 1.0 References: <20230329.132155.629765142788133576.horikyota.ntt@gmail.com> <20230329.173456.1185961934810139447.horikyota.ntt@gmail.com> <935191FB-083B-4060-89FC-466F61FAA391@yesql.se> <1252075.1680547394@sss.pgh.pa.us> <20230403190837.qubpnwugfe2k2g46@awork3.anarazel.de> <7E06F879-7E20-4A6A-862F-CA72CDC9A323@yesql.se> In-Reply-To: From: Robert Haas Date: Thu, 6 Apr 2023 13:18:34 -0400 Message-ID: Subject: Re: Should vacuum process config file reload more often To: Melanie Plageman Cc: Daniel Gustafsson , Andres Freund , Tom Lane , Masahiko Sawada , Kyotaro Horiguchi , PostgreSQL Hackers , Amit Kapila Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 6, 2023 at 11:52=E2=80=AFAM Melanie Plageman wrote: > > Gah, I think I misunderstood you. You are saying that only calling > > AutoVacuumUpdateCostLimit() after napping while vacuuming a table may > > not be enough. The frequency at which the number of workers changes wil= l > > likely be different. This is a good point. > > It's kind of weird to call AutoVacuumUpdateCostLimit() only after nappi= ng... > > A not fully baked idea for a solution: > > Why not keep the balanced limit in the atomic instead of the number of > workers for balance. If we expect all of the workers to have the same > value for cost limit, then why would we just count the workers and not > also do the division and store that in the atomic variable. We are > worried about the division not being done often enough, not the number > of workers being out of date. This solves that, right? A bird in the hand is worth two in the bush, though. We don't really have time to redesign the patch before feature freeze, and I can't convince myself that there's a big enough problem with what you already did that it would be worth putting off fixing this for another year. Reading your newer emails, I think that the answer to my original question is "we don't want to do it at every vacuum_delay_point because it might be too costly," which is reasonable. I don't particularly like this new idea, either, I think. While it may be true that we expect all the workers to come up with the same answer, they need not, because rereading the configuration file isn't synchronized. It would be pretty lame if a worker that had reread an updated value from the configuration file recomputed the value, and then another worker that still had an older value recalculated it again just afterward. Keeping only the number of workers in memory avoids the possibility of thrashing around in situations like that. I do kind of wonder if it would be possible to rejigger things so that we didn't have to keep recalculating av_nworkersForBalance, though. Perhaps now is not the time due to the impending freeze, but maybe we should explore maintaining that value in such a way that it is correct at every instant, instead of recalculating it at intervals. --=20 Robert Haas EDB: http://www.enterprisedb.com