I've setup a Wal Shipping (standby) in postgresql as:

In the master, I've enabled archive_mode = on, archive_command to a shared location between master & slave and archive_timeout.

In the slave, I've configured the Restore_command to recover those wal files from shared location and created a standby.signal file.

But how to monitor through SQL if the slave is synced and applying those logs?

I know in streaming replication we can:

-- on master
select * from pg_stat_replication;

-- On replica
select * from pg_stat_wal_receiver;

But what about a manual replication using wal Shipping?

  • Please ask one question at a time.
    – mustaccio
    Commented Feb 11 at 22:05
  • 1
    Ok, edited with only one question.
    – Astora
    Commented Feb 11 at 22:40

1 Answer 1


You can run this query on the standby to figure out the timestamp of the last transaction replayed from the primary:

SELECT pg_last_xact_replay_timestamp();

To see if the server is still a standby server, you can check if it is in recovery mode:

SELECT pg_is_in_recovery();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.