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 1w837K-000AFH-2l for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2026 21:28:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w837J-002P1A-1f for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2026 21:28:49 +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 1w837J-002P12-0h for pgsql-hackers@lists.postgresql.org; Wed, 01 Apr 2026 21:28:49 +0000 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w837H-000000004nJ-3jgU for pgsql-hackers@postgresql.org; Wed, 01 Apr 2026 21:28:48 +0000 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-7d7f592b8beso197904a34.1 for ; Wed, 01 Apr 2026 14:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775078927; x=1775683727; darn=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=jlTRJTq/gz1jqftRM0JkEGubCWyv3w28POtCoDsCWKU=; b=H3R7jeBWJ5seBJ/NDv1GqjHDlI2wMlF9fBW+4MPbDw+loPujrpq+J1YQZdkh86gDOD rwXZMkfnjqT4XyqviVMJC/LnVDdstTkUUToHqz1y7mUHVALXt/SBEWzJv/zm2cvXn8p3 eaKrKLc3g8GeHrIu2sWl6EfWCV+07hU+sW4KBZsohnRdfU1/fyuDPBAcAZGx/oPeDIDr ItIc746y8nZln4wFaSNf8HxUOU1OvKMb1Zdy3UbCN8nwprlIjWFepF69+SG98on3AQf+ 8QA+GO4/PiADEdegBhGuljQnxxNmyxq5JeDmkfsph2lIJwUNcXLXcyE2N1sO2z4YYRnq 71Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775078927; x=1775683727; 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=jlTRJTq/gz1jqftRM0JkEGubCWyv3w28POtCoDsCWKU=; b=Rh5zJqh04LRouJfOZIiR/OCWmKOnd1Fm21VG4lsUfBU3/cWDnn01Wqac6bCe/rr9fI RJNkmxQEUglHKDi/DMyU+KM32+MMG9TK2P3OMX1ubblWHLf2cKAbMCpOTwYFkJHych9e xPRXvcfPvZqF8Lni89H8oHJJt6J/0U8UiF2dRGpGitVCSqcWYgpS6WVJM80wmbamMr1w EtkC4hYL9U+DBgjZvE7p4n98lD/a+XqS6OwPReF3U2nutE8W0TsyNT0Qmrqyck/xQvfb cMXh9vAlI4a0zqjtI/a40+Is80kYx0RXkznALxFedBV/9W9mQ++0hFvEsghOVIRnnbU9 m2ZQ== X-Forwarded-Encrypted: i=1; AJvYcCX0bI/6azxdc7c6pknd8ucWVGkfFFN/nOzqwYAQeDLzrX7/QV4nMWrqadrAKiiwebpexVxppZjZQuk17kX7@postgresql.org X-Gm-Message-State: AOJu0YykSwDtBQlGB3MVWzjl9Y91VY0GCjccyuB76YU5S2OtwCtdOftW S/UkQyJl/7vzCbJm/e+h8UjS/M6IKx58xQJoGtr/NTxlZUHQVXfV7ODXhxwRpg== X-Gm-Gg: ATEYQzxE99DXQZ+SBxmGNDY0J4zS/SQsThysDmF7rYjkwrSCTx98ViOt9BhABHK+V4Z SfmL5kkPG+rACSl/RXX8dGhabTri1DePm91X9Ss0VhbKTfdGL9n9g0POPFz/mSxteS+td2w+Lwh xV21YQDHHwnZyHSztRSF71jYTSRULUYRf+OrL/PjNlO8CEzhB7KZvzIl4hB0vcLCb5cVl097hUJ dIETJdKip6az9P7+AuRig6J0y1W6OojSVdekPmT1JV3H6zj2CLImMNL5Dr5leT35WzoqeoR7aAJ bZNABSsLbENzNHJHXxfaa6Kt3ev+xtaGCXIF76/aBU/lonNoAeUNC9lYy+CgNSt7Y78d0e78s3n uF8b45hCo81Z/cXwtx5vM6Rg94UuSe9K17gGz3RxAB9ErOyjkHNwf9DIeXSrmxu0GVpPhwnTrm6 usGqwrI3cje+TuDnW1bl/vOkmMWlUo4uSwl7cV1xkgoQ2OPAPo9bCqD+YfSpxSDyrJgRV1nsReA onRpZSInq3UkLZLlngsMw== X-Received: by 2002:a05:6830:34a0:b0:7d7:5959:946f with SMTP id 46e09a7af769-7db991d8c86mr3817924a34.7.1775078927353; Wed, 01 Apr 2026 14:28:47 -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-7dba7355dd1sm688970a34.21.2026.04.01.14.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2026 14:28:46 -0700 (PDT) Date: Wed, 1 Apr 2026 16:28:45 -0500 From: Nathan Bossart To: Sami Imseih Cc: Bharath Rupireddy , Robert Treat , satyanarlapuram@gmail.com, pgsql-hackers Subject: Re: Add pg_stat_autovacuum_priority Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk + bool needs_vacuum; /* threshold exceeded for vacuum */ + bool needs_analyze; /* threshold exceeded for analyze */ + bool is_wraparound; /* at risk of XID/MXID wraparound */ I've been thinking about whether to also return whether autovacuum is enabled in the view, i.e., AutoVacuumingActive() && av_enabled. My instinct was that would help explain why autovacuum isn't picking up tables that are eligible for autovacuum based on the view. One wrinkle is that it'd report false even when autovacuum is working on a table for wraparound prevention. I'm also not especially excited about further complicating this stuff for folks who disable autovacuum. Furthermore, the value of the reloptions and autovacuum GUC are discoverable elsewhere. So, I'm currently leaning towards leaving that information out for now. + if (vactuples > vacthresh) + { + scores->needs_vacuum = true; + if (av_enabled && AutoVacuumingActive()) *dovacuum = true; } nitpick: We might be able to simplify this a bit by 1) storing "av_enabled && AutoVacuumingActive()" in a variable and 2) reworking the code to look more like this: scores->needs_vacuum = (vactuples > vacthresh); *do_vacuum |= (av_enabled && scores->needs_vacuum); ... but others might find your version easier to read. Otherwise, 0001 looks good. In 0003, I think you missed renaming the last argument to compute_autovac_score() in table_recheck_autovac(). I didn't see anything else in this read-through. I'm planning to start preparing this for commit tomorrow. -- nathan