SELECT pg_wal_lsn_diff(pg_last_wal_receive_lsn(), pg_last_wal_replay_lsn()) AS replication_lag_bytes;
SELECT * FROM pg_stat_replication;
This provides insights into the current state of replication connections, including lag.
iostat
for disk I/O and iftop
or nload
for network throughput to ensure there are no bottlenecks.VACUUM
(especially on the replica if it's set up to allow it) and ANALYZE
to clean up dead tuples and update statistics:VACUUM;
ANALYZE;
wal_sender_timeout
on Primary: If network issues are suspected, increase the timeout to give more leeway for replication commands to complete:ALTER SYSTEM SET wal_sender_timeout = 'time_value';
SELECT pg_reload_conf();
Replace 'time_value'
with the desired timeout in milliseconds.
max_wal_senders
: Ensure there are enough WAL sender processes allowed on the primary:ALTER SYSTEM SET max_wal_senders = 'number_of_processes';
SELECT pg_reload_conf();
Replace 'number_of_processes'
with the appropriate number based on your replication needs.
pg_basebackup
or the method used for your initial replication setup.Let Dr. Droid create custom investigation plans for your infrastructure.
Start Free POC (15-min setup) →