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 1w3Fcz-00131V-2V for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 15:49:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3Fcy-000skn-0f for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 15:49:40 +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 1w3Fcx-000ske-2D for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 15:49:40 +0000 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w3Fcu-000000001Qx-3V8y for pgsql-hackers@postgresql.org; Thu, 19 Mar 2026 15:49:39 +0000 Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-4671cbce465so620875b6e.3 for ; Thu, 19 Mar 2026 08:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773935376; x=1774540176; 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=bTmnqX9h3MfbqUcWddJK2mGaCXbH+J0yogODBuGGWpc=; b=N4gs1owRC6iGP3CKeY8VAEtDtjnl/WzP+WeQib2nMxzaFm0/d5Y7/JuFst4hYhcQkA FAjNUg993BixFq4Mu+J/Aysq245ne15/97Oonrlf7rYuRTWBFZxJmO8cWSNE97HHZzOQ eevmAtXLd8+75pdAXhBn8wSBzsld8bfb/A4yVGphQ36nhNqH5uHbPlSWdGezamVSEACN gWlZMCBeNzLt0UxDkjscEfNdLYzvXv/RS9nr6LYePBODNJFJOo6DiGxIhEt4b2X5vFlh TBN6YY6X9/1obrEdIwl85iMrUeOfhPDTLb/A45epS/gDSKf3HI+Ynp3HGCKKYZ2xjPIY 8+BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773935376; x=1774540176; 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=bTmnqX9h3MfbqUcWddJK2mGaCXbH+J0yogODBuGGWpc=; b=P+XpuwOzTQwuXoJIlXkOZSBlAks6OJvq4AwFxLlouSGnnbnQEo7HFAYkY98pvPfX2f yjOyuTtMTQ7by/IiM2gIvRey16EAQOEKgArtRwHo7qvT0asswXKEihWJfXzWGUKXE2e4 L5l+xrfA5jAe/cxOOrb6ppbHzTyoXJIq1hpVxPlRmpWPVMoLlkJZlo2Wypmy0J9+DuF5 2VtQLAy53YoFJf2yUT+WLV3sPmy1tJIEhHZik7g77kq3o+wTvEijPpsyyPSldsv9PG7C lhz2OWvgZVCZUaxfkyaM/JxtjUB/iTrAIfb0LibWkNcxQRpH4CmJWef/F4oU2UMCOVab dtcA== X-Forwarded-Encrypted: i=1; AJvYcCUEtFgVm6hUGSu5VOp2/UwlvtW1nelWXFf4UG6mF65zAjv1iWCxrvEqBFnEFYFPKr4ARtcpFleAalRii1b8@postgresql.org X-Gm-Message-State: AOJu0Yy1lQM83V13RQsZi+D3h/X7O3rKk7XpYnF5dQXAbDjJReTymRc4 3MLRhiigs0Sql9Bua+ckLGjt92RJBgTy7RoGNZupxIzRpmopNiCduyf4 X-Gm-Gg: ATEYQzytsai/51jlSE8M/HTFtB8u3y+V3kbhiWqV7ix5319/I/21pbK2UQbxB2SnwfY uu2MMyhm4O3u2UbisUNyeBHRjIQG4dQMuqo7W9Lvb8ClTyEIVfjkiJdY48q/6ynhs9AI/VuUo+u ep1okyzTSFJNvEt7S2yjcBCK8yt3wc8/Ybm9xgyc4bzSTFyIWezSfqhBiO5nnFRMaxiAxLkdRO5 zdBac3ouLTjNPdd2ZZ4I7gMhRDR3oIJKABw4KxeFI6SR1KEu8kSgkEKm+Bgh3XZ3XhxbCh6iuds y9e7vSsRzRGcJGMPuKgU2fOSKiWXttCb1mpwAflXjpl51Bt01KAthaz4NJeeZ4uU2xDmcZ5KrFM IMp2ljrgoVZN7iL/eMrXzsTpHKZNj1W0bZjDpiNF9f868fSo1v0ET6agr+dYfO0yqC4SZXeKXIA WDpV82vvFe07+pMjfsqsrDl5DCGw83pWJS3BCD31P+mTOBkEcKp0a2OPBv9Y6fynPDOmafsW5Ua 1ZerGgSH0qZPYJbe4fLhQ== X-Received: by 2002:a05:6808:2e4d:b0:467:11fa:40a1 with SMTP id 5614622812f47-467ba2a0681mr4940576b6e.43.1773935375881; Thu, 19 Mar 2026 08:49:35 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 5614622812f47-467c9c61c1csm2596610b6e.11.2026.03.19.08.49.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2026 08:49:35 -0700 (PDT) Date: Thu, 19 Mar 2026 10:49:33 -0500 From: Nathan Bossart To: Greg Burd Cc: David Rowley , Sami Imseih , Robert Haas , Robert Treat , Jeremy Schneider , pgsql-hackers Subject: Re: another autovacuum scheduling thread Message-ID: References: <3ca1e398-c787-47e9-9afc-8e298b94dac0@app.fastmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="RN2w2FxbILsPbe/8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3ca1e398-c787-47e9-9afc-8e298b94dac0@app.fastmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --RN2w2FxbILsPbe/8 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Thu, Mar 19, 2026 at 09:49:34AM -0400, Greg Burd wrote: > My concern isn't that wraparound vacuums are inherently alarming, I agree > 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). > > In that 1.4B XID window, force_vacuum tables have XID scores of 1.0–8.0 > (age/freeze_max_age), while typical active tables accumulate dead-tuple > scores of 18–70+ within hours of their last vacuum. The exponential boost > doesn't activate until failsafe age, so force_vacuum tables are > systematically outranked by routine bloat cleanup for what could be days > 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 to the list no matter what, it just might be sorted lower. >> 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. > > That would definitely help. If autovacuum_freeze_score_weight could be > set to 8.0–10.0, DBAs could manually restore the priority we want. Done in the attached. >> 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 >= effective_xid_failsafe_age / >> Max(autovacuum_freeze_score_weight,1.0)) becomes true > > This is clever, it would make the aggressive scaling kick in earlier when > the weight is higher. At weight=8.0, you'd get exponential boost starting > at 200M (failsafe/8) instead of 1.6B. Seems reasonable. I've added this, too. 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. -- nathan --RN2w2FxbILsPbe/8 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v13-0001-autovacuum-scheduling-improvements.patch