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 1w3HIo-0014Zi-18 for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 17:36:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3HIm-001YdN-2w for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 17:36:57 +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 1w3HIm-001YdF-0k for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 17:36:57 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w3HIj-000000002gY-1Qrh for pgsql-hackers@postgresql.org; Thu, 19 Mar 2026 17:36:56 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 697017A016A; Thu, 19 Mar 2026 13:36:50 -0400 (EDT) Received: from phl-imap-14 ([10.202.2.87]) by phl-compute-02.internal (MEProxy); Thu, 19 Mar 2026 13:36:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=burd.me; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1773941810; x=1774028210; bh=c53++wrErXbHXy5pePGhD5O5UQsKzqWdmTqk6NeiUd8=; b= SZ7sdMuMYrtq4ZWQnbdtQS0PKb1cKI222fcdTkOa9WFlk24GOMMANsNrdPtxx2g/ TWVi3HyJz3/oQgjgoB2pJymySHri2KBCBMeqFQo9/m32W37JRTc0MOz9aD84/bOE zKr056bhiSfcZprYx9KM6Nbb97lPG62z2zZ60o5pa0BEa19Pbl45OKP0MntHvPLJ bhlx/Pd8+u3PeMtfaPqkxw1fJu059WXIFucOpIc1wdJbRM9jDSPD3M1iopb+MNF/ bXb+S9bhKJCz6I1YKkUHTY8onQDM8TOr88wn1HEz2GXopiaYDDX/vtDV8wTNVR8e 4l0/Rw2N0AY6htn4UMU8vA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1773941810; x= 1774028210; bh=c53++wrErXbHXy5pePGhD5O5UQsKzqWdmTqk6NeiUd8=; b=w V+Df0EldVlk8D3eaZxCc9/czDEgU+3o0DAKSjse+mJ+JIsWbD5xR1ZQFt2FdYDq5 kxj/4o2IkmszN7luGXmmzEOYJAC4wQBWs0KgNAIf4lLgDvZyZh9k2Igi2LexaU+k heDkkf1/eLHdcqyg7KaeWGIk26YJNRE6Mrnio/d5tAnt9u5UV1QXbmGrFXfG63iS yxWzza2YUN9+D1MaT0zsr7WEHS6Cb0qJDS0lhS6cec2Vap5RXB4zVqzjNVaoPEHz ZNwNJf2NhNX/pgRb9s3CiXSoA3+huMTmNgDjv1fg6jO9yRLK5RR6aZD6YqLdHx4R Ws+6QyIiNpBAIelhRlRkQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeftdejiedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedfifhrvghg uceuuhhrugdfuceoghhrvghgsegsuhhrugdrmhgvqeenucggtffrrghtthgvrhhnpeduvd eikeefieeutefhvddttedthfdujeeukeejheeuhfevkeffudevleelhefghfenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvghessghurh gurdhmvgdpnhgspghrtghpthhtohepjedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht ohepshgthhhnvghiuggvrhesrghruggvnhhtphgvrhhfrdgtohhmpdhrtghpthhtohepug hgrhhofihlvgihmhhlsehgmhgrihhlrdgtohhmpdhrtghpthhtohepnhgrthhhrghnuggs ohhsshgrrhhtsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhhosggvrhhtmhhhrggrsh esghhmrghilhdrtghomhdprhgtphhtthhopehsrghmihhmshgvihhhsehgmhgrihhlrdgt ohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrd horhhgpdhrtghpthhtoheprhhosgesgiiiihhllhgrrdhnvght X-ME-Proxy: Feedback-ID: i675e48f3:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id BD2A2C4006E; Thu, 19 Mar 2026 13:36:49 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AWZBDbbOkN4Z Date: Thu, 19 Mar 2026 13:36:29 -0400 From: "Greg Burd" To: "Nathan Bossart" Cc: "David Rowley" , "Sami Imseih" , "Robert Haas" , "Robert Treat" , "Jeremy Schneider" , pgsql-hackers Message-Id: <74279eb3-8e3a-4b76-a56c-10efce2ff41e@app.fastmail.com> In-Reply-To: References: <3ca1e398-c787-47e9-9afc-8e298b94dac0@app.fastmail.com> Subject: Re: another autovacuum scheduling thread 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, Mar 19, 2026, at 11:49 AM, Nathan Bossart wrote: > On Thu, Mar 19, 2026 at 09:49:34AM -0400, Greg Burd wrote: >> My concern isn't that wraparound vacuums are inherently alarming, I a= gree >> with you that reaching freeze_max_age isn't a crisis. The issue is a >> scoring-scale problem in the gap between freeze_max_age (200M) and >> failsafe age (1.6B). >>=20 >> In that 1.4B XID window, force_vacuum tables have XID scores of 1.0=E2= =80=938.0 >> (age/freeze_max_age), while typical active tables accumulate dead-tup= le >> scores of 18=E2=80=9370+ within hours of their last vacuum. The expon= ential boost >> doesn't activate until failsafe age, so force_vacuum tables are >> systematically outranked by routine bloat cleanup for what could be d= ays >> or weeks in production. > > I think "systematically outranked" makes the problem sound worse than = it > is. Once the freeze age is reached, the table is going to get added t= o the > list no matter what, it just might be sorted lower. Yeah, that was a bit of hyperbole on my part. :) >>> Having said that, I'd not realised that Nathan capped the new GUCs at >>> 1.0. I think we should allow those to be set higher, likely at least >>> to 10.0. >>=20 >> That would definitely help. If autovacuum_freeze_score_weight could be >> set to 8.0=E2=80=9310.0, DBAs could manually restore the priority we = want. > > Done in the attached. +1 >>> Maybe we could consider adjusting the code that's setting the >>> xid_score/mxid_score so that we start scaling the score aggressively >>> when if (xid_age >=3D effective_xid_failsafe_age / >>> Max(autovacuum_freeze_score_weight,1.0)) becomes true >>=20 >> This is clever, it would make the aggressive scaling kick in earlier = when >> the weight is higher. At weight=3D8.0, you'd get exponential boost st= arting >> at 200M (failsafe/8) instead of 1.6B. > > Seems reasonable. I've added this, too. +1 > Something else we might want to > consider is scaling the score once the freeze age is reached, just much > less aggressively than we do at the failsafe age. It probably doesn't= make > sense to start scaling too much at 200M, but at 1.5B, yeah, we should > probably process the table sooner than later. So a scaling factor relative to some point like 200M? Maybe... but for = now I think what you have in v13 is about right and a solid improvement = over what's there now. > --=20 > nathan > > Attachments: > * v13-0001-autovacuum-scheduling-improvements.patch LGTM! best. -greg