How to monitor logical replication initial sync?

Started by Doug Gorleyabout 8 years ago3 messagesgeneral
Jump to latest
#1Doug Gorley
doug@gorley.ca

Good day,

How does one monitor the status or progress of an initial sync under logical replication? For example:

* I create a publication in database db_pub
* I create a subscription in database db_sub
* In 15 minutes I want to check an see that the initial sync is N% complete

Is it possible to tell when the initial sync is complete, or better yet, how complete it is?

Thanks,
---
Doug Gorley | doug@gorley.ca

#2bricklen
bricklen@gmail.com
In reply to: Doug Gorley (#1)
Re: How to monitor logical replication initial sync?

On Wed, Mar 7, 2018 at 3:23 PM, Doug Gorley <doug@gorley.ca> wrote:

Good day,

How does one monitor the status or progress of an initial sync under
logical replication? For example:

* I create a publication in database db_pub
* I create a subscription in database db_sub
* In 15 minutes I want to check an see that the initial sync is N% complete

Is it possible to tell when the initial sync is complete, or better yet,
how complete it is?

​This is a question I'm quite interested in as well (and one I do not have
an answer to).​

​Does anyone with more familiarity ​with logical replication have any
suggestions on how to determine the status of the initial sync?

#3Peter Eisentraut
peter_e@gmx.net
In reply to: bricklen (#2)
Re: How to monitor logical replication initial sync?

On 3/15/18 09:19, bricklen wrote:

How does one monitor the status or progress of an initial sync under
logical replication?  For example:

* I create a publication in database db_pub
* I create a subscription in database db_sub
* In 15 minutes I want to check an see that the initial sync is N%
complete

Is it possible to tell when the initial sync is complete, or better
yet, how complete it is?

​This is a question I'm quite interested in as well (and one I do not
have an answer to).​
 
​Does anyone with more familiarity ​with logical replication have any
suggestions on how to determine the status of the initial sync?

Something like

select * from pg_subscription_rel where srsubstate <> 'r' and srsubid =
(select oid from pg_subscription where subname = 'mysub');

The key is checking the srsubstate column for 'r' (ready).

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services