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 1w7249-004tP3-0Q for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 02:09:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7247-000S24-2B for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 02:09:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7247-000S1v-1F for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2026 02:09:19 +0000 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7244-00000001uti-49u5 for pgsql-hackers@postgresql.org; Mon, 30 Mar 2026 02:09:19 +0000 Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-7d4c383f2fcso3841930a34.0 for ; Sun, 29 Mar 2026 19:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774836556; cv=none; d=google.com; s=arc-20240605; b=CQMlqiAhiGa+CpR2Wcd8Y4FTd6vNC593i8Bo2ZrYt3FnpSlQLNTknRiaZuFnoMTe01 VAOeD/+ySsAl830R9GtEqpIunEnu2FuZXROIJXdfgpOOllvsrrum/51tSWglNxj/hpMx J0VCxc/3NAXokbKGZ7Ukrjs5ewLgodY6WwgaRZZeyCs1Gr2gYJxQyO3Vx6ImJbebmXk7 p6IzjnnOQSA90S30nXtdUfrrHwdxUNOhyb9WPWcZscrwAnBqyUGI+/jSWQahT7Ai2UcG 6bAkcddInS6yEaSRyIS3lkTSTbLac9QCswwgMDMiPML2l1HG1PygJvmc7MQcH+LXZsXR M7ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=I8KzEz0cD8750x8QL89NHSs6xMnqC2tUzoePhl00zkQ=; fh=rqsvTQ72xmi/YS8IPNfy5foG6vPFvl3yXEp/sEebzTA=; b=Vp9+aGH4h+UdIFrR87c7JrBJWpXdfIE+WdbsI6o8bSOz6dMRoNBtC/VskjlV4D9NIE AsO/IAMjF46BF3/flBKyrfWRtLGpDSd39m2V7J/RjEwVS0WPGQpMz00H/HKaUQLIdW0B Zt7VQX34lsYCIIE7/Fwr6QBP+BkaB7jpy1gVHdHPsXXlRP1JoqOrIrA4LLXrECF3SyJA 5kZrFiqJuglB8PWm3/v+htuHxCO02hUANV7E2yS/h9kbUpRQpLM3mWyXSFkracCThUqC Lmkfs3JVGBjawMH9ZPuMDMbJ7IV65c9WVOKortIOAhCGt1kzuR52MmBTyAJV5jcieRID VxgQ==; 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=1774836556; x=1775441356; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=I8KzEz0cD8750x8QL89NHSs6xMnqC2tUzoePhl00zkQ=; b=oEWk7u3U11Plcu+4DmmQmNi1n9zfOZHQDJRDUmaV0li2kQ8yObK1KnqJdCYqgKVmIa X63aX8lgxi7Yz2gAzjwnx6/oATTi7nwx0SBUWfeG8mMSt/HMw3heUpRTs+hVCdIlsjlI 67DQYBXyfLXoMMS7mZbGekB7297tCiduG14hxCFlgHNIaG0xnucK9YoUHTrYuCf5VugI Lamr17hoGGvD1BWDNuWqqn3Ep1OZBIbTXhDrCexlLBLgvyYAZYRUCrmbMg0SLdgcU5p4 jHwc1v2NaQdZzcNSu7HKPQQBMqISgnEkwoog8Z7r6lBtqfOkyGbM5FoYBll9eE/GbuT9 bmfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774836556; x=1775441356; h=content-transfer-encoding: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=I8KzEz0cD8750x8QL89NHSs6xMnqC2tUzoePhl00zkQ=; b=DVbQOcUWAoRhDnnfCtkxI8S/AMoKP3jSgXAVhvyTRiEVIf6ql3pEw+pKUdGobHevBy bCfOCdSYtM4tzazxbTVVdGk1DhK+zPu6AB2S3Q3NyDayp8y3B5PdhOYaNhta4ZQBZP79 +/GHgFi83K2hdISL6ajQGxfw9Xn2KLn8HviAyreWCKfjjV27oTwR9bGQ/mRnLsMnSfMl 6837zVtQbIxprykWv1vDMnTsn4lLMihzAPUdJKO7pvyj51zpGvANitpqsEjSSyev7/0p RhTnLmtgyPCWMUAC2dGIQfwpGT+TH+xmwSOSZK0LfGioGax9GuJOPjgF68id3X9/hToA gpFQ== X-Forwarded-Encrypted: i=1; AJvYcCVmJPSYjU0nu20xL0FnFqOVwJtl6igF0o5XcM1NB8IK4urCP65ZeEbwxZar0OBCrYfYMeV5xO1BNWi4FCTZ@postgresql.org X-Gm-Message-State: AOJu0YyEbBODdxUdSPyYFKYPTm43j5wPXs6lo6M1cYpUiD19WmFp9lCd DO1PApQnACCa9Bq+Okv2n8yGHo6gdAu8/aJv5m2bJYAvSCnrI7jkWxXxYb9p5ELhxfnpPT41/Vl 3RFJsxDmYA+U5X6exW6mWAj0XZ9YboA8= X-Gm-Gg: ATEYQzyxRGF932qz+BNoRcCoG5zCURYur3vKvRaXrHnWlY992h3pRYvZxV9mjJlWh48 7GNX9tv9NaDqHNY0tyGz31Dq18psDgILBKiivGPLANaT5kHY5oKcA/m/19scKE298DKx1YU54nh ag8AZo4B0KH2vYO4kJCBRkNe5N92422eYquA1l2ar56L6JAkWmrczucS31JOLVcfUaLk/9Lbn7k TbQJ06+p0N5vvcsZCbNokJGt+B2OWl0jPEwMuNHbVU1pFXsUeT7zSnU1tUgA11a/U2hhpX3AVJ+ 30u3x8ceIQ1p2/gX6bj9x9NvuKST8acLrXZkDLE= X-Received: by 2002:a05:6820:2109:b0:67e:34de:ee3e with SMTP id 006d021491bc7-67e34def067mr471451eaf.49.1774836555716; Sun, 29 Mar 2026 19:09:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bharath Rupireddy Date: Sun, 29 Mar 2026 19:09:03 -0700 X-Gm-Features: AQROBzBh1BfeU_KwCD1k_MGV5YwjTyEvyYaVsthOGV1N1oBNI6xp0i31yy1mbF0 Message-ID: Subject: Re: Add pg_stat_autovacuum_priority To: Sami Imseih Cc: satyanarlapuram@gmail.com, pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Sat, Mar 28, 2026 at 10:54=E2=80=AFAM Sami Imseih = wrote: > > > 4. Is the view intended to be exposed to PUBLIC without any ACL restric= tions? > > > 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. +1 for pg_read_all_stats. > > 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? IMHO, we can have pg_stat_get_relation_autovacuum_priority defined as a C function to give the autovacuum scoring as of the given moment for the given table. It's easy for one to write a function to get scoring for all the relations in a database. This keeps things simple yet useful. -- Bharath Rupireddy Amazon Web Services: https://aws.amazon.com