Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIuwG-002hZr-1W for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 20:26:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIuwE-007aSz-0T for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 20:26:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIuwD-007aSr-2X for pgsql-hackers@lists.postgresql.org; Tue, 11 Nov 2025 20:26:01 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vIuw7-006bNM-0U for pgsql-hackers@postgresql.org; Tue, 11 Nov 2025 20:26:00 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-640a503fbe8so114734a12.1 for ; Tue, 11 Nov 2025 12:25:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762892749; x=1763497549; darn=postgresql.org; 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=uPrLQSmjetuKlJ+G2/b2LJRSQgtKynXCkG0dqMS3SA8=; b=dvFi+fBl/aTq13jSvTSrK5l8CGCtFg0RfNJrws4OlAvvIK+tHxgskoTPtPdrr6wbIs KvXLcaV6ZJWnWSiLlXGHv4PKwYY+eqh7Ee3cfuxwJklDznU08pLBxitfqH1CseZDTgky bQL4xmg2D+iOSvBgbBI0Uo7B1z1R/6CJcc5BSu04C44X+UDMfBFhLULEuURNWJvaXIAc oSNwTdjSCCmyFTn/6XmyT404kcmdg1HnpDJHeOlZMT2n8rUCSHKhSDmGz/+/2hQSelpQ nZZ0R1HDBNTLRpHsLJXdT9ipo8Uw5/O65OmXMor0wgMCmBbZfcZJyQjLL/oYtXNivI66 YwwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762892749; x=1763497549; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uPrLQSmjetuKlJ+G2/b2LJRSQgtKynXCkG0dqMS3SA8=; b=vy3ZLXxR7zbFKjVXTkhxbyqbUhCrVcwurjuIbU9u2xmn9archxCiIUwM09iieVCP9V +GLVccKLTuAGpTByZQdELlLS0ET8D/6V+pJAmRQkl7XergQacnyrTwto7B6sEWITZJL6 /rhcQCrNBBoNGMAkRrU8ZwUEuGHlNfVBKZs02lGxcpiqBM7/rXiL/F5JgcAF/wQbzVpb IASs0CUxQL/m2z3aWmQDgWWK8LIXUskfT50zttzRJoBG1vVicAVt8de7urDkgd5pwuCH M4vsFT/x0rYK7vWMACO8D/AIZvInMo0vQ4GYqVf261i5iD67Bu6lx8196oOQIUQftOHF G3vA== X-Forwarded-Encrypted: i=1; AJvYcCUFoC+lUI9e63WcedZ4tbBbJZa+BanoibsR5/dIVeYIG0BU+CpRv4jDPjCJAf8MiGDCJODK2dKcGlKTFp4x@postgresql.org X-Gm-Message-State: AOJu0YweoejpjOcYqTtkkFEkmQzzT6kBb6/k74j2w9Y3XMD5P/6DMP/t /LxcVxpmRhjej1okazZ8+DIzZOPxAkcmRAZVxKIAHVTMyzF1kJb6DcOGnE8eAkTpUp791X/l3mk zf5FvHUz0OoamAdjKYvM6PMzjgUgP1V8= X-Gm-Gg: ASbGnctsUnZApknwCBGWv8PCDAL24XxxYote/K8qsUaX3gw3ispDyXcCBkGrjRQGd9Q pgSLfB6LMxAwjY7TqH+p9UWdWrqwbJU0fI5wr0Sp16S/w2eyVuNX7PpJvZIGxX6kTUQGhcBGiKP /YZ+mYCzJ/R28qyeBgxf3u1D0e93DQyrP++sJYkTShsjQrCMt8xVQqUXBIRazFKifnPZPEDjFpU aCT0QYnj+1DBQBQwNykPQ2Bs/ZvMUQ0hKCYeysrElkek1h7xMB438QXSZa0wlGOsLY= X-Google-Smtp-Source: AGHT+IHgaXpS+LCa7ExgqbSUCZUXM1VvIDIxecr6ziICIe6RNE5l1LILpsWX3D2shhfrh+ir6w5BM1WuMkRrTGQ5Iwc= X-Received: by 2002:a05:6402:44d7:b0:640:c9ff:c06a with SMTP id 4fb4d7f45d1cf-6431a4f5628mr373625a12.15.1762892748390; Tue, 11 Nov 2025 12:25:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sami Imseih Date: Tue, 11 Nov 2025 14:25:36 -0600 X-Gm-Features: AWmQ_bkDa1iUZaxqFgmih3ae7t64jXrQUJlVfNFMz4PG-1EyVXXeiKXOKsy5_00 Message-ID: Subject: Re: another autovacuum scheduling thread To: David Rowley Cc: Nathan Bossart , Robert Haas , Jeremy Schneider , pgsql-hackers@postgresql.org 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 Sat, 8 Nov 2025 at 08:23, Sami Imseih wrote: > > > I'm confused at why we'd have set up our autovacuum trigger points as > > > they are today because we think those are good times to do a > > > vacuum/analyze, but then prioritise on something completely different= . > > > Surely if we think 20% dead tuples is worth a vacuum, we must > > > therefore think that 40% dead tuples are even more worthwhile?! > > > > Sure, but thresholds alone don't indicate anything about the how quick > > the table can be vacuumed, # of indexes, per table a/v settings, etc. > > The average a/v time is a good proxy to determine this. > > > > What I am suggesting here is we think beyond thresholds for > > prioritization, and to give a chance for more eligible tables to get > > autovacuumed rather than workers being saturated on some > > of the slowest-to-vacuum tables. > > Can you define "more eligible" here? What I mean by =E2=80=9Cmore eligible=E2=80=9D is that once a worker has it= s list of tables that meet the autovacuum thresholds, it=E2=80=99s trying to get through as = many of them as possible within some time window. If the workers always go after the slowest tables first, they=E2=80=99ll sp= end most of that time on just a few heavy ones, and a lot of other eligible tables m= ight end up waiting much longer to get processed. Eventually the slow tables will be the bottleneck anyway. > I think I'm not really grasping this because I don't understand why > faster-to-vacuum tables should be prioritised over slower-to-vacuum > tables. Can you explain why you think this is important? The thing I=E2=80=99m hoping to address is something I=E2=80=99ve seen many= times in practice. Autovacuum workers can get stuck on specific large or slow tables, and when that happens, users often end up running manual vacuums on those tables just to keep things moving for the smaller/faster vacuumed tables. Now, I am not so sure any type of autovacuum prioritization could actually help in these cases. What does help is adding more autovacuum workers. > if we have the autovacuum worker refresh the list and scores after > it's done with a table and autovacuum_naptime has elapsed since the > list was last refreshed? That is an interesting idea, but refreshing the list that often may not be such a good idea, it could be quite expensive on large catalogs. -- Sami Imseih Amazon Web Services (AWS)