File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,6 +45,43 @@ union all
4545 from repl_groups
4646)
4747union all
48+ select
49+ ' WAL' ,
50+ case when pg_is_in_recovery() then ' N/A (replica)'
51+ else (
52+ select
53+ ' Current LSN: ' || pg_current_wal_lsn()::text
54+ || e' \n ' || ' WAL files: ' || count (* )::text
55+ || ' , ' || pg_size_pretty(sum (size))
56+ from pg_ls_waldir()
57+ )
58+ end
59+ union all
60+ (
61+ with slot_info as (
62+ select
63+ slot_name,
64+ slot_type,
65+ case when active then ' active' else ' inactive' end as status,
66+ case
67+ when not pg_is_in_recovery()
68+ then pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn))
69+ else null
70+ end as lag
71+ from pg_replication_slots
72+ )
73+ select
74+ ' Replication Slots' ,
75+ coalesce(
76+ string_agg(
77+ slot_name || ' (' || slot_type || ' /' || status || coalesce(' , lag: ' || lag, ' ' ) || ' )' ,
78+ e' \n '
79+ ),
80+ ' none'
81+ )
82+ from slot_info
83+ )
84+ union all
4885select ' Started At' , pg_postmaster_start_time()::timestamptz (0 )::text
4986union all
5087select ' Uptime' , (now() - pg_postmaster_start_time())::interval (0 )::text
You can’t perform that action at this time.
0 commit comments