A
A
Alf1622015-02-04 16:28:30
PostgreSQL
Alf162, 2015-02-04 16:28:30

How to check replication backlog in PostgreSQL?

Good afternoon!
I would like to see how much the write to the slave table lags behind the write to the master table with streaming replication in PostgreSQL 9.3. To do this, I made a test_time table of 2 fields: id (integer), t (text). Added trigger:

my_time:=to_char(current_timestamp, 'HH12:MI:SS:MS:US');
update test_time set t=my_time where id=new.id;

And put this trigger on after update. As a result, both on the master and on the slave, the time is the same.
Tell me, please, where could be the mistake or how to do it differently?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alf162, 2015-02-06
@Alf162

Problem solved. Calculating the difference between what the trigger wrote to the database and the value of pg_last_xact_replay_timestamp () on the slave, I just get the desired delay time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question