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 1w6XrN-004P5W-2U for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Mar 2026 17:54:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w6XrL-00EpvC-17 for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Mar 2026 17:54:07 +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 1w6XrL-00Epv3-0B for pgsql-hackers@lists.postgresql.org; Sat, 28 Mar 2026 17:54:07 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w6XrJ-00000001WhF-1yun for pgsql-hackers@postgresql.org; Sat, 28 Mar 2026 17:54:06 +0000 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-b982d56dac4so532408166b.3 for ; Sat, 28 Mar 2026 10:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774720444; cv=none; d=google.com; s=arc-20240605; b=ku9MUaQruuCJGUd20/C/vhhkFAXSpn6XoCq2xMAUqfYAs8s4WXEcY22boqZHEjyCQB +EbdNpHd2a5Xqwv2tiTPzP4PFer1JmEVzSe/9F87/bC169IxUV17EmFbO5VeRWb+/LIt 4K0svv60cc3ltutNlUck0g8nWnFBNhAdjPqDYc24eEB5eJygENeVufI29HLSMcj18NeN MVOGGRKvmoaoZF7nc7bf5Z0i5VrJm63ZjbaBaeQw2/+nwgvQeAu1ALro2KCbl9bevNvd Jlzstj26BkFV+zq6IhSYvBlRkk+iW0qphcq6wHI/iyC3NfUMsbbRnWAwxYxN11TjpqUv lwBA== 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=A7AVQiFz9fd7KhFKWdUy58y4gbixbpjY0uiOREmTYz0=; fh=qhYIndeN0kXzyyGNRp6scaf6noV/XlADOcFMKS/3Boo=; b=NDpns3qb1Sy6HrDL/WCrbKG8gbEN2N+KSBGrO1xoZnzv2Z77nXaJ613RYZFK4/DCp1 zrd0mSxZlhQxH3lrQrWspCnMyWU4rFbTVmJCbGi68jCfV7koOm0kcmNAGHxuO2prkOi0 k/7ufk28egNezZdr54uYYwiVGrKJRDVHWDnqRu7KEPPB5qglGFHri8IbOdJo2lPsK2a4 BoOySdKV3SG5XZAvBXx/0sibBx1ucWC9GJ3LJ/iinmD0+0sGcLSQtdDtcoUcAUsCAMAP xq/qUwvvjxHW/3oRWgWDfKugDD2o46prRVc5dvpaSsDumo0vfnXGyulBSdPLbCqhHS3l jY8Q==; 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=1774720444; x=1775325244; 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=A7AVQiFz9fd7KhFKWdUy58y4gbixbpjY0uiOREmTYz0=; b=hd3tOu7jcS/mT3RcablcRgEOIahmfVwDj3O56z7llSL4fOFXL+Zhn29Uxa+dx56Wu5 6QiBXBWE7Z89ic/w7814jc/kQ94K2cibwXl0R//6zwPiBMMt/VTbiE5K7rMrlZZEktHL zoJvyzP3kkgNxL9tHP4nSTjg1xvTRHycXAc/offDDCq7doDB4+qefSdkmTFDS48KW/ZC pI1offHkdonbuYtlC6U135yRMjuZtrRwhiYDwEKbNBN9qXj47D2UBvB0wBNYe9KzM4RI bO/rXYTgEYBqvJ309r6L0rAcWbEKcXYw3O1PbQ+kL9zqeelz4id7b5wEOqgFbubw4QlW ngQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774720444; x=1775325244; 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=A7AVQiFz9fd7KhFKWdUy58y4gbixbpjY0uiOREmTYz0=; b=b5VM7QtXFXpX8b66zgnnFjHN44/hRvUPq+gk0Z/+K4E+9OjwsC87URqcMD0OI0ICNi UJGooCoazxFbDq47lt6jJgV9R6RtOeY6H2Sjh9kqZHlvmdbLZ0wE0965GPiQ/GS6u0Gx yHLMJ6x8TL+wQrt/8Vef/CMINMfwHHfmV02KWEUMB+mDOZEXUx4ek3BMB2UpCEVxpms3 JLQv4dyix0rHxa1eV96Ief9F98eEp2PRy7FeJiMH8l524tBaPuV8ZpSYNPsP0A4Lduub C0MCGibSrmWxumqvRRApngk0Bt+TzGD94AqF6aJzUXeiQFxsY9N0k6PH6kd8nDtTZi6i oMVA== X-Gm-Message-State: AOJu0Yyd5BcopAEuPN4mx+3BF3s89T+EO5862TFmp4YfMfXg+eUaxaMm 3sASnGSd5zmAatHpfAZ+76GhUG4ebQihcAWBIvgJpHkyrYOm/CeV5Y1lD3FdU9A0Dfzl75Mjwby lwNpvS3tzUhkpNOpqL1Aw+1XscMAJr50= X-Gm-Gg: ATEYQzyoWKGcN6VcjNawkfzeSa8v2I1+N5795XBzuq//M72/oaMV2O1OCByL1ULFxhw oz2NSChxExCIL/6SDuuKUW3MN8tO3tkDrVNV2A8XmOVSnHWH570jobhit91lwBzJ5MoQmN7yydA kEN7iFKI3QUPuu72nDYPWyZFyhsy8/lnfojP/+w29J3664iNBwdUwFdIMEzDjakls6lkJ4Kdxmx Uy/sliL1KjN7QABhnI1uHOL7AhY70asRau8q2fjrDYJquVuufgXnisSTFvnKpMPK8pCxTN1mL/N uj798Q== X-Received: by 2002:a17:907:98c:b0:b98:435d:9939 with SMTP id a640c23a62f3a-b9b502bc862mr464055366b.9.1774720443953; Sat, 28 Mar 2026 10:54:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sami Imseih Date: Sat, 28 Mar 2026 12:53:52 -0500 X-Gm-Features: AQROBzBfY_71G8StQHx62lOjn_mbCglL9eC7ulcN_19CodXTq8J7wB-EW0Ab_VU Message-ID: Subject: Re: Add pg_stat_autovacuum_priority To: Bharath Rupireddy , satyanarlapuram@gmail.com Cc: 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 Hi, Thank you all for the review and comments! > 1. Please add CFI in the function pg_stat_get_autovacuum_priority, as the list of tables can be very long good catch. Will add. > 3. Please add tests for tables with autovacuum = off Yes, I will add this test as well. > 4. Is the view intended to be exposed to PUBLIC without any ACL restrictions? > 2/ Do we need to revoke permissions on pg_stat_get_autovacuum_priority > for all and grant them to pg_monitor or similar? Especially since this > function loops over all the relations in a database, we may not want > everyone to be able to do this. I think you're correct there. While the data is not sensitive, it should have more controlled usage. It's only taking an AccessShareLock, but you would not want anyone to be able to run this since it's doing real computation. I think requiring pg_read_all_stats is a good idea. Will do. > 5. Catalog version number needs to be increased This will be left to the committer at the time. > 2. Should we add filtering? The current approach pg_stat_get_autovacuum_priority > does a full catalog scan without any filters and can be expensive. > Can we have the per-relation prioritization computation function in C > and provide a per-database computation function as a SQL function over > this per-relation function in system_functions.sql? Yes, perhaps we should do this. So we can have a function called pg_stat_get_autovacuum_priority() that either takes a NULL or an OID to either return all the tables or just a single table. This is a similar usage pattern as pg_stat_get_subscription or pg_stat_get_activity. pg_stat_autovacuum_priority will be a view that wraps around the NULL variant of the function. The case where the OID is passed we just do a SearchSysCache1(RELOID,...) whereas the other case will do the full catalog scan. What do you think? -- Sami