How to check the replication delay in PostgreSQL?

后端 未结 6 1634
眼角桃花
眼角桃花 2020-12-28 13:57

I would like to measure time between insert data into master-table and slave-table using streaming replication in PostgreSQL 9.3. For this I create table test_time

6条回答
  •  青春惊慌失措
    2020-12-28 14:21

    on master, you can do select * from pg_stat_replication;
    this will give you:

    |  sent_lsn   |  write_lsn  |  flush_lsn  | replay_lsn  
    
    -+-------------+-------------+-------------+-------------
    
     | 8D/2DA48000 | 8D/2DA48000 | 8D/2DA48000 | 89/56A0D500 
    

    those can tell you where your offsets are. as you can see from this example, replay on the replica is behind.

提交回复
热议问题