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 1wHufw-007cMd-1P for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Apr 2026 02:29:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wHufu-001a5e-2S for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Apr 2026 02:29:18 +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 1wHufu-001a5W-1U for pgsql-hackers@lists.postgresql.org; Wed, 29 Apr 2026 02:29:18 +0000 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wHufr-00000003HNE-3SWO for pgsql-hackers@lists.postgresql.org; Wed, 29 Apr 2026 02:29:17 +0000 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-7dca4debedaso10495126a34.2 for ; Tue, 28 Apr 2026 19:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777429755; x=1778034555; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=x118gX7zWGf6KtTkoJoAEa9tEHU+MMXzlUtyzF1PJW8=; b=gd5TH0NR/N+qztHUAdiLZ9LELQ5CvD++DSmtS+BEnjIU40zqnfDrjLwH7bDTT2NpCV 9WTDBQnAIaOKmRMjnFtPGrTCRfO01u7rm6Ye3WmAlFuTWHLeuFvridytjsFUMfBnl532 AXDFh32ORT2z0NrZycl7jkIDKGk41caZ6c3sh8cy1J4JhRbgg3AHT5FgVfT/M60Mk4z/ 35e6Sw/miF3V51bW0hd0/7kokq6NUKvDW0n1+W4ybrQqKP4GR8YTqPv1ZyYuiYdPOELf E6jvaUN9ioXoWR6+5ahbg9FwlhRdSrcch5HWJTBP4tYc7McpJi0Xic5M3mMKODAnooy+ UAGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777429755; x=1778034555; h=in-reply-to: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=x118gX7zWGf6KtTkoJoAEa9tEHU+MMXzlUtyzF1PJW8=; b=C4eOIg29OopqyOFcbRsgzMI6u8isq+YR9IrCfIgAzEqdgSNkhsnUYlgNOT0RWU5L+H V9WKN0uT7Dhb1TJXex7+Lilm+/fLu0x6tQiyJT5Z0+DsUm2JGfF3ZaYlVypHungxKX9F Yzla965UmpFSegC4w+AjUjF0W/dmflHPqLfft6Js7phjGZ9+QnWecoiFpVz4taJgksXr hA9orlcXPEkHto/r5tdstmsthBvMHFfxyftypBxLxT1w84zMgxuvpazwMX1KLsWbb11x N9Tuj+KrU7PoLGGfJujtTpZYnp/3oOT2nZ+q8XlbiyuOa0sQSCTqTdOxwYzRircuiUsj EC8g== X-Forwarded-Encrypted: i=1; AFNElJ/KXE/5ZVozbrI2WPGZP1maiZqBbqWkRvQFeFWIdofQNcbgrDU1hZXfkUdNbxtlaeh53Zas4P/OhDXjUgU8@lists.postgresql.org X-Gm-Message-State: AOJu0YzpN6bT7nSbFe+gtJ1WDJ0XhLC41JtdvgRhjPF9Dk2sANicwdHQ PvJRhMOudd/9poZyGONqENOdaZpY+Nf3Yv0WXyYykt04CAS3q4Tb26Ge X-Gm-Gg: AeBDies6aodO26ewSciK222Ln6DB7ocP70hGZDJ4DjL0MxW6Qdf5VwfDrjAPh/JGmz6 Aqds9AiarkzK2CC0jQJ2GAGDwzyytfn1yedi791zYa7Ndx2DCTstY8CkhHNbTFqrZUZiGG+nisN SigdmN4DuDrKo5eSvIzDOIDCiHIS6bVx1kDSz41O+OWg2IYKWSuRvENjAxte9sUnTF3ILFqANy/ jZBm0z2XzgKqQJvUYQHHUUmMkWorOrXYNdxWafZlRIY0NhyyQaV1vqpZGc94CKcXKoCJzvsZzrc p3AQl6WUiUtHyhOCnoxw9YgJYSXEBVXHyvfEQgctIHQ+nOtXSpzuI2aCBJbu9whTz/HYEUusVTu JEuOM+qBWscssZdQXT6TggWwmpVMid8W1ABuEwb25EmluVmVAa4cpTL482lfCMQy/KVrZ66JaCJ nxg9lV4Zgb8ddOKbPqNaioKdt8xvEjcbQAUMyGWRMqxoNcNkHBlJID3u7fadBoVhE6kN4euV0Pz 6WH3/dWRCZOUwxiCTQkxWkxNnjPwpml X-Received: by 2002:a05:6830:6ac8:b0:7d7:cb13:3fef with SMTP id 46e09a7af769-7de9a0fb947mr2985499a34.20.1777429755450; Tue, 28 Apr 2026 19:29:15 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7deab990331sm418059a34.16.2026.04.28.19.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2026 19:29:14 -0700 (PDT) Date: Tue, 28 Apr 2026 21:29:12 -0500 From: Nathan Bossart To: Gurmokh Cc: wenhui qiu , David Rowley , "pgsql-hackers@lists.postgresql.org" Subject: Re: New vacuum config to avoid anti wraparound vacuums Message-ID: References: <8udBo1vgTX5lWBFmq4HKWGy94FOomFWWc_xr4Hc7jJ91NzZbdvWB_QqfVDF1jmSk-Eavuuu-y3aUZOJZPubVdUcpLHTNmf-0zDuMkzBArug=@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8udBo1vgTX5lWBFmq4HKWGy94FOomFWWc_xr4Hc7jJ91NzZbdvWB_QqfVDF1jmSk-Eavuuu-y3aUZOJZPubVdUcpLHTNmf-0zDuMkzBArug=@protonmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Apr 28, 2026 at 09:21:35PM +0000, Gurmokh wrote: > The config parameters in [1] autovacuum_vacuum_threshold, > autovacuum_vacuum_insert_threshold, autovacuum_vacuum_scale_factor, > autovacuum_vacuum_insert_scale_factor and autovacuum_vacuum_max_threshold > rely on regular activity to trigger autovacuums. However it is entirely > plausible that these can be configured with values that are not sensitive > enough and a table breaches the autovacuum_freeze_max_age triggering an > aggressive vacuum to prevent wraparound before any less aggressive > vacuums can be triggered. > > In my experience I have seen tables that have significant activity and > still not meet the criteria to trigger an autovacuum and subsequently age > out. I have seen production systems slow to a grind waiting for these to > complete. > > What I'm suggesting here is to have a configurable parameter that > represents a value as a percentage of autovacuum_freeze_max_age that > would enable a table to be autovacuumed before a vacuum to prevent > wraparound is triggered if none of the above conditions are met. So your new parameter is meant to trigger non-aggressive vacuums in hopes that it might advance relfrozenxid and avoid an upcoming aggressive vacuum. Do I have that right? If so, I'm not sure that such a feature will make a tremendous amount of difference. Non-aggressive vacuums can only advance relfrozenxid (thus preventing an imminent aggressive vacuum) if they don't skip any pages and are able to obtain cleanup locks for the relevant buffers, but page skipping and conditional locking seem like key features that would make a non-aggressive autovacuum less disruptive. I think there's a good chance that even with your parameter, a preemptive non-aggressive vacuum would be followed by an aggressive one shortly afterwards. Perhaps there are other reasons prioritizing a non-aggressive autovacuum would help, but it's hard to tell from the details you've shared thus far. Would you mind elaborating on what you are seeing that is causing your servers to "slow to a grind"? -- nathan