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

Started by Pavel Stehuleover 1 year ago1 messageshackers

Thread notes

1 note#bug
hackorum-bot#bug
hackorum-bot
1 day ago

@global #bug

#bug
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

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