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 1wAXmT-0004iu-2n for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 18:37:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAXmR-001KfT-2e for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 18:37:36 +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 1wAXmR-001KfK-1k for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 18:37:36 +0000 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wAXmQ-000000002Kv-22Z6 for pgsql-hackers@postgresql.org; Wed, 08 Apr 2026 18:37:35 +0000 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-40423dbe98bso34800fac.2 for ; Wed, 08 Apr 2026 11:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775673454; x=1776278254; 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=BJiqX6iNlUy+sVZsfyy6xwnCdL2tz1cp3JMm1/urRDY=; b=W4kFi3RwsZmFEMRQiIAzhctFr8FrmPFbzPfmB+Hvxg1jILgkUeB169WFimYll3ytfQ wSMf1CQapYRwbgXB8rQlAgUE9yjFsPn+D3yixHIcX6k7xiPJxy6yfkZTyYHfWK/N/Kjd hou6AsdgNzPCuCekICfaaNRU0CLxyq2jInDzv+sBgIJCLmtjZWzyLCbzvd3LaBOV50Aa J7vXev0TpHYCqhPpiFjTKLrzicL7GHNb6lg1xWUgvxodgYBJ184MqD6xigd9YWe2B9w6 ys1xVeF9NFJL/NeDlNVcy2vjXg8AHaZs9bFZqSIdgH0jqP6ewwphyUU24o8cgQd2c+p+ L1uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775673454; x=1776278254; 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=BJiqX6iNlUy+sVZsfyy6xwnCdL2tz1cp3JMm1/urRDY=; b=A7/1qBbZq3kJdYBuMRKKdKZQZoPSkouoAeimpIWWkX1pNfRcf7iSNg7pQKShBHc1mp iDKZjor0rLWJzMjVC1wy3Y/QL5Bs7xnaiFaNgzw8YeVvWUPd619SfkJn/QZ2ScQR7IGA ulRNQNkYs80pPm5B61q209vb0W3XFpj/yuist9Trc0DPdYLfIL7VtqZ04UaGC9efn7sp 9hMp02cn0VayvHmG3twDpsvOktIORuzmVXo106+jmIFEiI+B3hhTawUosHHHGG3SjCVQ 4nexsfUteXckfAwTpT8yLIMt9ONzqIut2BOddin8PEaJdvNlB3A2lg95J+d/v8vob1se obLA== X-Forwarded-Encrypted: i=1; AJvYcCX1ILtsZMfzRXRNc9TOyk96np74tQ1gg9/rnbYYTEtW0Km+rFa8MN4TUDxaOAQbRt0H96/diRh0OvSnWVkn@postgresql.org X-Gm-Message-State: AOJu0YzZ+xwlBtH+XqnIad9FjcGvw1Kd8n+Oq0iUuFdpgCxUBG1vX1i9 7X+vBIwmfF/5Hz48J9c6w/ANxc9D0EGwJpYSyiDsTjXQKvTpPnfA4uIN X-Gm-Gg: AeBDievnrZFmzlM81bOh6MRLqTf9ZURCavTyfJaO8LsTQjE9LyMeuHxwTodnEfHc2yX QfhoEJOgwizLMynmnUHpZb3bYtq/cigP/nNPLh/URq6NVOzDGfjXtV8+rMq0juiGOnyeL/bp+bn M1yNAXyjGXzWSyJ7h3osYhsgrocpaGUzEoV+cazP2Pp9W4McUno4aYUQ6eZ5OmAkNP/usvVSRdH +gemDuIw/Wqw402kgKT5Ts237qFrwvmoQQ+Gj2XgPKvsES4PBjtRpyyOZ7cXkAwP6FBdhEUaoOn 7o7N3uZnh8UXJQ8fgj82wTSJLSRqowSCKj3HzeJXE49iEtOWkCfVUuYYcw65aRzYxgUvgU1HoVd wFQmmbF+hJOcV8yZon7vu40bgh21pxqitdV80Tw2ydhtkPTKA23SJdKOk4twLhRfpPvYKt/BJyO AKv5fRTKfWTytmYWISIQLnB5uylltZgMZMo84q8S14EFT0mj2HbmKhDoREZZKmgtn9Erk43HzBC TA9YlQLnuuPqMBENFbotw== X-Received: by 2002:a05:6870:9f0f:b0:3e7:eee7:9466 with SMTP id 586e51a60fabf-423bdc616cemr302516fac.39.1775673454423; Wed, 08 Apr 2026 11:37:34 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-422eb25a55asm17377734fac.10.2026.04.08.11.37.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2026 11:37:34 -0700 (PDT) Date: Wed, 8 Apr 2026 13:37:31 -0500 From: Nathan Bossart To: Sami Imseih Cc: Tom Lane , Alexander Lakhin , Bharath Rupireddy , Robert Treat , satyanarlapuram@gmail.com, pgsql-hackers , tndrwang@gmail.com Subject: Re: Add pg_stat_autovacuum_priority Message-ID: References: <5684f479-858e-4c5d-b8f5-bcf05de1f909@gmail.com> <3077290.1775668665@sss.pgh.pa.us> 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 On Wed, Apr 08, 2026 at 01:28:06PM -0500, Sami Imseih wrote: >> + if (AmAutoVacuumWorkerProcess()) >> + pfree(tabentry); >> } > > This works too, but v1-0001 is more generalized and we don't have to > care about who the caller is when deciding to free or not. Well, I think if we were building this view from scratch without any knowledge of autovacuum, we probably wouldnt bother manually freeing the stats entries based on the value of the GUC. We'd probably just let the commit/abort code take care of it, which AFAICT is what we do elsewhere. Manually freeing the entries is also risky, which commit 02502c1bca touches on: Note: pfree'ing the PgStat_StatTabEntry structs here seems a bit risky, because pgstat_fetch_stat_tabentry_ext does not guarantee anything about whether its result is long-lived. It appears okay so long as autovacuum forces PGSTAT_FETCH_CONSISTENCY_NONE, but I think that API could use a re-think. This seems very much to be an autovacuum-specific hack that we shouldn't be propagating elsewhere. -- nathan