Open
Description
It's worth to see how many files / WAL segments are currently located in pg_xlog/pg_wal and what's the total size.
select now()::timestamptz(0), count(1), pg_size_pretty(sum((pg_stat_file('pg_xlog/'||fname)).size)) as total_size
from pg_ls_dir('pg_xlog') as t(fname);
select pg_last_xlog_replay_location(), pg_last_xlog_receive_location(); -- on replica
select slot_name, slot_type, active, active_pid as pid, (select pg_size_pretty(pg_xlog_location_diff(pg_current_xlog_insert_location(), flush_location)) from pg_stat_replication where pid = active_pid) as lag from pg_replication_slots;
select pg_current_xlog_location(); -- on master