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 1w7bkt-005WQt-18 for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 16:15: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 1w7bkr-00BEYn-2C for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 16:15:50 +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 1w7bkr-00BEYf-1J for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 16:15:49 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7bkq-00000001zez-0R7p for pgsql-hackers@postgresql.org; Tue, 31 Mar 2026 16:15:48 +0000 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-66c1d0f2b2bso2631837a12.2 for ; Tue, 31 Mar 2026 09:15:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774973747; cv=none; d=google.com; s=arc-20240605; b=Hy1vGmgte7VKvo/VWycn6DNszA0bhZaYgWBlvA9Gz5Yubew6cxtTrNNB5EO6AE2aDX qpSShqWJklITOW9dtJQMo5MVPiuEfgqID4gVkhAbhdMryw9krWFIM3YMdUHYyNdB3mv5 NrqkdNYgtPB6QZPuI7CcBaBoOWEJ/B3Mj9MLfYRAtkbV3Z6ykeZtVILq7nvm7WvFw3Px WthYaykaHND6HS61MUxg8b6Cv3ExMpFyhOaUlhPmRchyTQedz/wypj1Syvp5swjTfBrX y5hElP0CWcl7olE/i6fYbpllwm8YujHm7eK2iALIGBCC5f312iipLOHYNAXstEZ4Lc68 udCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=T03kqT7B6ArqliZg2wLuncGb7t3eX0v6EnxWBW13bCo=; fh=yRPd9dUgWb+M6n+9ztxt8pHNkEJdH6uj37AdAXc/GC8=; b=ZhStLM+PTg5bm7/NpsFwRlUPfLuyYxvqFd2L5ez2VdIOz0GjID8wICZc/qGYSUl7Uk SKm0KkdZYGThO+G5us97QyYG/y9Y4a4XwhlFFjK2pXiSrWBm2HJavggvyvwA2YsWVQo2 5498OPqBc8zP1r3aBn/MRslEfZLtZgr4ClUgH/6kxbehRG7q17BJsIIxSzFgx3447aUH IoA93HkoHi3VRcNTklsvNSptZ/6c1xreyNmQdfUEdjkSP7oqQQ3bZ+J1Unw6o+7fkxq9 /S23IrbKJcMdWxYuqBx3275XtTPUmYRfhqdWtRHxrf62th2lHNjGYhz/gkmqBk3Cwm/L Yyrw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774973747; x=1775578547; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=T03kqT7B6ArqliZg2wLuncGb7t3eX0v6EnxWBW13bCo=; b=XmVd+4zBVDHgOCwqlJN6XtrZMPxOIVHCl+vdnoUIO6M/rD036hmeu70aDDD+Fnn1ST yqqGIB7LpdZtQVRP2Ob4Tb8aslM/RzP8OnLeJqK7hEWQ43W1QYFL8/KykePMeRLg/yZL MbxSScOw1lwjudTqNlPlDqHgFbbBy58e/obg08kzV7QIIcAQArsmnKz7EXn0QE2PD1Vp +Y8Sp+G7mhWN4VDjj2JoPxaP2V7NrSIHtmNZjQslFJ4Zc9BaBwg+zH5/K0S1fcj3ncGW hGou7BJm1N2ZAydROCLfuS2QBxZexCqW7PQr2txurt1v40dXuryByijEFqMcOjNQEL9l b4ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774973747; x=1775578547; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=T03kqT7B6ArqliZg2wLuncGb7t3eX0v6EnxWBW13bCo=; b=b5E6y9J50wqVZhEfyJduV7rudkXl5f9UuD2HsaZxAEg4pHP9yv5s04YR25fWhrr7K8 A1wW1k05Rmrb0IWDlSN1F1lNGlDMPLtP/NANQ3QliD+ZoV3u8XJxjOkbyB+CAtrz/HL+ 4Ka5soln+xuc1pieoyVi7g7DNVayu4borJlFAzKTjE4G3bEFch1zG1/uU38FvPDDb/Uz 2IUL0Eln+du50TN4e9f1DLuktQO0qDPPotc3bWX2dnV0ssWkSol/sFmVDygbiZRqhncj pp1Qd8TajX5TYyFsUFiCv6I9rNZZSsybyFQIFyifDP/eDN8DwscFqRo76FDOo6uUg94d uZQw== X-Forwarded-Encrypted: i=1; AJvYcCX6LWMj6RUf2R+oNUXLo5DzyvloMcZf/zVb/mxgRgZo45ZmXVKFBtHLy6z876cerAKEsBJQSJahD88rPgwY@postgresql.org X-Gm-Message-State: AOJu0Yz87evBfI3sktcTGadUsE6M61mM80No9LqDXkFtdMazj2EN+jQy wzPmrUIbJlp6WTWiQDM3C2d6994xCshcOeQZgHnxjo4j9GRUTi/qzc7Bjn/CEFH8PFUmh8QKSB1 EDUABy+m4eM/RZTLmZiNZ5Jpy15SPfyU= X-Gm-Gg: ATEYQzxV0uBuNDF6/OG7wLIOq/4GEb+ILJucJ5xGrbXfDS5WTIoN4JauDroomuvsXY1 AyP+LGTM7cEdRppttnBI+r7jVFR7N4Mr3qjXnUZi0PhqtAesqvrDS4DOOF2UVi3uoYKtguB4mqz 9gMzD54iir+UNfFdHb6gYreltZ3/8sLgbg0OeCruLO65WXweui3EVg38VVQCZNhmpQCYAwqNfNJ DJgOrPHqMFdp1rii8Ru0qwlvYXdgWfz+r3zAhOojruTFcJu/ireHFzcNwM8lzfkVIt5aWCfAGBK rrZ1QA== X-Received: by 2002:a17:906:6311:b0:b9c:1081:4c44 with SMTP id a640c23a62f3a-b9c13b5be32mr21629766b.27.1774973746360; Tue, 31 Mar 2026 09:15:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sami Imseih Date: Tue, 31 Mar 2026 11:15:35 -0500 X-Gm-Features: AQROBzBOs4B-3CuYCMaID_UyfWb9KTo2ig7RIZ2L33r949Kwt_R6jtTgdt0sp0A Message-ID: Subject: Re: Add pg_stat_autovacuum_priority To: Nathan Bossart Cc: Robert Treat , Bharath Rupireddy , satyanarlapuram@gmail.com, pgsql-hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > + * force_scores set to true forces the computation of a score. This is useful for > + * tools that wish to inspect scores outside of the do_vacuum() path. > > I'm of two minds about this new function parameter. On one hand, I see the > utility of forcing score calculations even when autovacuum is disabled. On > the other hand, when autovacuum is disabled, the scores are actually 0.0, > and it's probably a good idea to report exactly what autovacuum workers > see. I went back and forth on this. Showing 0.0 when autovacuum is disabled would reflect what autovacuum workers actually see, but I think the more useful behavior is to always compute the score based on the table's actual state. This way, a DBA who has disabled autovacuum on a table can still see that its score is climbing and needs attention. The view shows need, not eligibility. This will also make the view more useful for maintenance jobs that wish to supplement autovacuum by looking at high scores and triggering a manual vacuum for those tables. > I also see that we're not forcing the computation of the (M)XID > scores. Is that intentional? hmm, the force_score does not need to be in the force_vacuum path because the score is calculated there naturally when the table is in need of force_vacuum. The force_score is there to ensure that we are not existing early in the autovacuum disabled case. > I wonder if we can rework this function to always calculate the scores, > even if autovacuum is disabled or !force_vacuum. This way, both paths are > doing the exact same thing and reporting the same scores. I prefer that we still calculate the score as if autovacuum is enabled for the reason above. I do think one potential middle ground is to have needs_analyze, needs_vacuum, eligible_analyze, eligible_vacuum fields to differentiate. I just rather not hide a score because a/v is disabled on a table. > + > + > + vacuum_dead_score double precision > + > + > + Score component based on the estimated number of dead tuples > + needing removal by vacuum. > + > + > > I think we should make sure the column names align with the names given to > the new parameters [0] and the new "Autovacuum Prioritization" section in > the docs [1]. I will look into this in the next rev. -- Sami