RE: Allow pg_read_all_stats to read replication origin status

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Virender Singla' <virender(dot)cse(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Dilip Kumar <DilipBalaut(at)gmail(dot)com>
Subject: RE: Allow pg_read_all_stats to read replication origin status
Date: 2026-09-25 05:52:21
Message-ID: OS7PR01MB1831776FC76EDA2016DC8030DF5802@OS7PR01MB18317.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Virender,

> I observed that there are other similar views granted read privileges
> to pg_read_all_stats [1]. Views like pg_shmem_allocations,
> pg_backend_memory_contexts, and pg_aios are real-time, point-in-time
> snapshots of the system's internal state. It looks like the definition
> of "stats" for this role has practically evolved to cover general
> system observability, monitoring, and telemetry data.

For me pg_shmem_allocations and pg_backend_memory_contexts are something like a
statistics because they show the size of total allocated memory. But, hmm, pg_aios
might be a good example.

> Also, pg_read_all_stats is granted to pg_monitor anyway.

Yes, IIUC pg_monitor is a superset of the pg_read_all_stats.

> There actually was prior discussion on granting this to
> pg_read_all_stats instead of pg_monitor. However, the work was split
> across multiple changes. The first change, which related to removing
> the hardcoded superuser check, was committed, but the thread stalled
> before the second change (granting access to pg_read_all_stats) could
> be completed.

While checking the old discussion, there was alternative approach to export the
pg_replication_origin_status to public [1], which might also be good. local_id is
an internal identifier which is not sensitive, external_id is already public on
pg_replication_origin, and remote/local_lsn are also visible on other views.
Can you evaluate it also?

[1]: https://www.postgresql.org/message-id/20200608.174456.238992210909952383.horikyota.ntt%40gmail.com

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2026-09-25 05:53:17 WAIT for LSN does not reject small negative timeouts
Previous Message kedar anavardekar 2026-09-25 05:40:29 Re: Proposal: Conflict log history table for Logical Replication