backend_xmin is null in pg_stat_replication, although repl. slot change it

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: backend_xmin is null in pg_stat_replication, although repl. slot change it
Date: 2025-05-29 05:11:40
Message-ID: CAFj8pRD1b=8BV5OspQMt63f=p=CZpAxnApPWMB2zVMybfO2k8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

why, backend_xmin from pg_stat_replication is not updated, although used
related replication slot effectively use something like this and blocks
removing dead tuples?

postgres=# select slot_name, age(xmin) from pg_replication_slots;
-[ RECORD 1 ]---------
slot_name | readonly01
age | 11162
-[ RECORD 2 ]---------
slot_name | readonly02
age | 196

postgres=# select * from pg_stat_replication;
-[ RECORD 1 ]----+------------------------------
pid | 7715
usesysid | 16597
usename | repmgr
application_name | walreceiver
client_addr | xxxxx.2
client_hostname |
client_port | 56266
backend_start | 2025-02-20 01:05:50.015719+01
backend_xmin |
state | streaming
sent_lsn | E154/773EA620
write_lsn | E154/773EA620
flush_lsn | E154/773EA620
replay_lsn | E154/773EA620
write_lag | 00:00:00.00024
flush_lag | 00:00:00.000625
replay_lag | 00:00:00.000754
sync_priority | 0
sync_state | async
reply_time | 2025-05-29 07:03:48.827431+02
-[ RECORD 2 ]----+------------------------------
pid | 4097782
usesysid | 16597
usename | repmgr
application_name | walreceiver
client_addr | xxxxx.1
client_hostname |
client_port | 42806
backend_start | 2025-05-28 05:12:43.210414+02
backend_xmin |
state | streaming
sent_lsn | E154/4F31E000
write_lsn | E154/4F000000
flush_lsn | E154/4F000000
replay_lsn | E154/2141B1C8
write_lag | 00:02:06.153229
flush_lag | 00:02:06.153229
replay_lag | 00:02:48.65516
sync_priority | 0
sync_state | async
reply_time | 2025-05-29 07:03:48.818324+02

It is a little bit confusing.

Regards

Pavel

Browse pgsql-hackers by date

  From Date Subject
Next Message Shaik Mohammad Mujeeb 2025-05-29 05:20:46 Re: Clarification on warning when connecting to 'pgbouncer' database via Pgbouncer
Previous Message Michael Paquier 2025-05-29 04:53:07 Re: Add comment explaining why queryid is int64 in pg_stat_statements