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 1vJHAi-00H8Qm-0P for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Nov 2025 20:10:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vJHAf-00EGP7-1P for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Nov 2025 20:10:25 +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.96) (envelope-from ) id 1vJHAf-00EGOp-0O for pgsql-hackers@lists.postgresql.org; Wed, 12 Nov 2025 20:10:25 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vJHAc-007PAx-1l for pgsql-hackers@postgresql.org; Wed, 12 Nov 2025 20:10:24 +0000 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-433261f2045so505985ab.3 for ; Wed, 12 Nov 2025 12:10:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762978219; x=1763583019; darn=postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=jmvy8G3EADi7BC12fcVRoyctrRMfwgYx/8T0jy2VJ+8=; b=H/eDeEpeJnVMrafPk9K5qVNaZjx4exhXrPKcklpEBiRxipLdKcGEHvha9hcztQIT08 5YwFKfGdKcMbnHktdiN+ikiN07h7cbMJUErPbvzd/+XLnAZ9ylCrLrhfkCIvHL6tx3Jv iFjeJko/O2E1oxmScDuHh/6HxfFwtyhyl8UCgRILuurKyQw8YG0ZGMfEu/x4R9l/C+LS AmHq3rWGSG9RgzqxaQOb7xkYH3VeIxEvmZdVHaGqr8n8R5iHtfmcNnD01jRJoxbSFMxo ZVyUe6kf3f5G8taGbumcZT5ChQaVnLisJOOnDj99cA8loe5ZBALzg2bPlwvspF6IIdd7 AO1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762978219; x=1763583019; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jmvy8G3EADi7BC12fcVRoyctrRMfwgYx/8T0jy2VJ+8=; b=aLC+HqVXQ8CRj9GSfEmaF0ZktpkyZalgg78SufAdMNJWQ7jqhCwZ203G/2EbU4dnmb CvBqnO4ongDjjyLSGd8eVe9bwfRwVQq5TLEjRJjkhi1ERL8AjFSsJYsiba2OQ3J23SKg 9aj14QuleeHhsC3tALK1/OnlhTMNK/8hdJ2HgdznGr30d7ADYnyO1fiuWjxpO5WRgta6 BeqGtiPsBhpoA8xOV27w0vspnHuUQLaKmajdzvwhZa6xNR8k/Y8Ssaiee7FzKs9lc7ij hMNFnMAmT8yFjj01JJ51UMhXH+MuHWoVbGrSzUgHVBzNebUjvirL2zStaArKa6EaMgRY +CsQ== X-Forwarded-Encrypted: i=1; AJvYcCUhpKLJq95zuqdyFrySXo9Fw+VuamkLggGyNOEI1kRAtdJY8OgMNsl08ri3W8TqtDhyT0c4MBk/0/zbGE5e@postgresql.org X-Gm-Message-State: AOJu0YzuMY4m7tgfiKBesUzzItSk65gmDZGakK4/0bPndZ+n3kNMqBqA 7kUBjhDoyJkHfOuoJUK2qytOPfphnJON88PJHszSKVV1EkenMo3ypb6A X-Gm-Gg: ASbGncvonQmObaoWupmWdbFBzPeQjFojp1qCx54Z1S/xXnS8UJTCX9XJ7wVu1v7G0/5 IMQMFrAJ0xHJZ5/G8nHBdhE/k6D34C6PmWNQsn2tRewJ7AlhK/622bdz7h2G/YDK4SrxDEieQCJ 4LPwAQILuED+AbJtlIxB1APh7p6xTZtAUmJ/SiDOTsFqS5kb+swaUSrTUV4Cg7bovE6AnsJuX2y F0wW5GLPopQp4KbGt1XUPBABcqiOKbXPJRgfBo3ugzzkKJ7YFv1j7m/H5QFFlGHk/M0SxmuFV5y dK2iCeOIxX92KnM+0vyIauo1mIGqBlta+NYFeC8lqetiWDUeWa7V0T+K525cNAfQzj8T+M4A8eW cGMh9+Rypyh8Bxdp+fW9HxcNVlSViU0H+V0NKZt20AM96q8e2rvdwr655ejSUec8bSLi6dIHwc8 aqN8zmtK0XCIEgrOQQYm4P+4KSNCoTVgs1izTmW9LOfACplp4XxGckcj4LqATn3PbeXGczeTk= X-Google-Smtp-Source: AGHT+IGgrE18BV9jxY+S3HK7Ii2UByUJqrxhQs02zKI25MxR6Pv3iiEJfKopvAhfTLNSAi1GRE0KWA== X-Received: by 2002:a05:6e02:3807:b0:433:7e2f:8393 with SMTP id e9e14a558f8ab-43473dddfa8mr54984885ab.27.1762978218842; Wed, 12 Nov 2025 12:10:18 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-5b7ab0dad07sm1345421173.37.2025.11.12.12.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 12:10:18 -0800 (PST) Date: Wed, 12 Nov 2025 14:10:16 -0600 From: Nathan Bossart To: Robert Treat Cc: David Rowley , Sami Imseih , Robert Haas , Jeremy Schneider , pgsql-hackers@postgresql.org Subject: Re: another autovacuum scheduling thread Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Nov 11, 2025 at 06:22:36PM -0500, Robert Treat wrote: > On Tue, Nov 11, 2025 at 3:27 PM David Rowley wrote: >> On Wed, 12 Nov 2025 at 09:13, Nathan Bossart wrote: >> > My concern is that this might add already-processed tables back to the >> > list, so a worker might never be able to clear it. Maybe that's not a real >> > problem in practice for some reason, but it does feel like a step too far >> > for stage 1, as you said above. >> >> Oh, that's a good point. That's a very valid concern. I guess that >> could be fixed with a hashtable of vacuumed tables and skipping tables >> that exist in there, but the problem with that is that the table might >> genuinely need to be vacuumed again. It's a bit tricky to know when a >> 2nd vacuum is a legit requirement and when it's not. Figuring that out >> might me more logic that this code wants to know about. > > Yeah, there is a common theoretical pattern that always comes up in > these discussions where autovacuum gets stuck behind N big tables + > (AVMW - N) small tables that keep filtering up to the top of the list, > and I'm not saying that would never be a problem, but assuming the > algorithm is working correctly, this should be fairly avoidable, > because the use of xid age essentially works as a "hash of vacuumed > tables" equivalent for tracking purposes. I do think re-prioritization is worth considering, but IMHO we should leave it out of phase 1. I think it's pretty easy to reason about one round of prioritization being okay. The order is completely arbitrary today, so how could ordering by vacuum-related criteria make things any worse? In my view, changing the list contents in fancier ways (e.g., adding just-processed tables back to the list) is a step further that requires more discussion and testing. To be clear, I am totally for serious consideration of reprioritization, adjusting cost delay settings, etc., but as David has repeatedly stressed, we are unlikely to get anything committed if we try to boil the ocean. I'd love for this thread to spin off into all kinds of other autovacuum-related threads, but we should be taking baby steps if we want to accomplish anything here. -- nathan