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.94.2) (envelope-from ) id 1vE82M-005u2c-VJ for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Oct 2025 15:24:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vE82L-001lHX-SL for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Oct 2025 15:24:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vE82L-001lHP-Ic for pgsql-hackers@lists.postgresql.org; Wed, 29 Oct 2025 15:24:32 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vE82I-004uCM-1O for pgsql-hackers@postgresql.org; Wed, 29 Oct 2025 15:24:32 +0000 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-63bea08a326so10526855a12.3 for ; Wed, 29 Oct 2025 08:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761751469; x=1762356269; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JBMt5BCgU/Ob+M8FSYvNq45sCWqAULkMXkN1hdAa2dE=; b=msmUmHZ2kzqytdAGGtpUPhO/yoPGOCZ4V8oUV+Kzj9PnC7GlKChq7b2W61NJ2mfe+p c/EyKBakWrdkSrCBhgpUHI3WF461sxbi6P7A0FZmLgNYaEhJO6Cky+Zu3C/wn8dX0etE 0L6XM93YgYTn5GkkHajQ7Deug+Dyw+UANRhhbIKQCXg4svJrT1MLhInJOV7fzH+v5LDT p1LWTeqU4oDQQ01OfyAY248QNRBXcf7ihq2gigSykIKfjdFFUYuDiGTBAGfntVT98nRe Irw+THB3ylFpVB2FNtgOoasy38evS++aqnmRPqjmv5+VTJj3H0h+yADFkZw4DUuvJtXl ma9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761751469; x=1762356269; h=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=JBMt5BCgU/Ob+M8FSYvNq45sCWqAULkMXkN1hdAa2dE=; b=W+ZW7HUkAYEdI6exfJg+x4h2fPyPEuR3tSPSk74AYoVRL5Ux7emU4tsz0cTyVsY/bJ C8rA1vfWGm/Jvn5IlzuRqObppgYxOAgrbdKbRoW5+8qidXfCWc7gZnWcO3+z32MTnoyL dreHp8inMaxSXVx7db6xtm6JpwmRk1MWWr4cYRxdEDirTkkmcFepG4GYo5w+D0smICbe IpUjhzFOeXoP53wUe7ndnu/90ByUHVI6aHuqcOttaFYl9UP/0g1TEaJv8IxWkTPddIFK tTzH7VgSp97cNkvKcBIu/T1+dEgchWBtScv5sL18Wtjof365yXWDsNRohdRry0jwj/yU 2SEg== X-Forwarded-Encrypted: i=1; AJvYcCVh0DEj/IuFFfXxs9pcKZRBDOBMoc1jVu8MwWmi7xjwtq9RUJeEy5WUhtEwaZ70K+JDnA7kj5ut1z/eSpUS@postgresql.org X-Gm-Message-State: AOJu0YwZS7AEo9RK4H6OMUa8V9X2rYm0HL/9bY4FrTe6oMI358SiKTwB 8l9s7rxeNxNOzYu29uzQ53Mh+H/MaNfNrrtp7EzOelGrfC+HDT0fX6nUa6QfIuUOvbLWYOe3mfd v7Msoy5G/2X+DctEHHQl1uYCfk6RUzwJJZ/ZQVJmh5A== X-Gm-Gg: ASbGncvirSIS0JIHlJPKtHFYQLWaJrTy7DVy2g0+E4TCDvbR4KnYYTgGRKZd+mmJPac GUPKoUGsfANpkdVCJLR6kegAklc5s6tmBdnXBod84H7hnkGJ7Wsp+RkVcsR3c/bINBXW6QDiznv vvNhIhJbvNBEv+O+xmOUu5ZdEIvIb1cQKy0mmRGWD6k/Nu+kOwi17TIQYy105eEcmnihK+87cJC subcPfQoJIb3EL1sJ6N+kVYIVP7w7n08FyY8vFc5WVOIyygtnvBaf8Be115GNIfcfRvXw== X-Google-Smtp-Source: AGHT+IFLdbE4VF+ZJghulL+Y1NC30fBDnhmqcq+OseqPxfViBSibdzCWQU+zjYHsB08duycgwy9yzjgD5suhzYkoNtU= X-Received: by 2002:a05:6402:3513:b0:63c:4537:75a3 with SMTP id 4fb4d7f45d1cf-640441af290mr2603019a12.16.1761751469274; Wed, 29 Oct 2025 08:24:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sami Imseih Date: Wed, 29 Oct 2025 10:24:17 -0500 X-Gm-Features: AWmQ_bmFIcvwnDdBDZxbzHcSaWBCirWv8J8yXvCxil0As9nk38lWLY119AQSPak Message-ID: Subject: Re: another autovacuum scheduling thread To: Nathan Bossart Cc: David Rowley , Robert Haas , Jeremy Schneider , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Tue, Oct 28, 2025 at 12:16:28PM +1300, David Rowley wrote: > > I think it's reasonable to want to document how autovacuum prioritises > > tables, but maybe not in too much detail. Longer term, I think it > > would be good to have a pg_catalog view for this which showed the > > relid or schema/relname, and the output values of > > relation_needs_vacanalyze(). If we had that and we documented that > > autovacuum workers work from that list, but they just may have an > > older snapshot of it, then that might help make the score easier to > > document. It would also allow people to question the scores as I > > expect at least some people might not agree with the priorities. That > > would allow us to consider tuning the score calculation if someone > > points out a deficiency with the current calculation. > > > > Also, longer-term, it also doesn't seem that unreasonable that the > > autovacuum worker might want to refresh the tables_to_process once it > > finishes a table and if autovacuum_naptime * $value units of time have > > passed since it was last checked. That would allow the worker to deal > > with and react accordingly when scores have changed significantly > > since it last checked. I mean, it might be days between when > > autovacuum calculates the scores and finally vacuums the table when > > the list is long, of it it was tied up with large tables. Other > > workers may have gotten to some of the tables too, so the score may > > have dropped, but again made its way above the threshold, but to a > > lesser extent. > > Agreed on both points. I think we do need some documentation about this behavior, which v6 is still missing. Another thing I have been contemplating about is the change in prioritization and the resulting difference in the order in which tables are vacuumed is what it means for workloads in which autovacuum tuning that was done with the current assumptions will no longer be beneficial. Let's imagine staging tables that get created and dropped during some batch processing window and they see huge data ingestion/changes. The current scan will make these less of a priority naturally in relation to other permanent tables, but with the new priority, we are making these staging tables more of a priority. Users will now need to maybe turn off autovacuum on a per-table level to prevent this scenario. That is just one example. What I am also trying to say is should we provide a way, I hate to say a GUC, for users to go back to the old behavior? or am I overstating the risk here? -- Sami Imseih Amazon Web Services (AWS)