On Wed, Nov 8, 2017 at 6:38 AM, Marcelo Kruger <marcelo.kruger@xxxxxxxxxxxxx> wrote: > Good afternoon, > > I have two servers hosted on Azure with PostgreSQL 9.6 databases. One database is production, the other is standby. > For replication I use stream replication between servers. However the application of the archives in the standby database is slow, always generating replication lag. > > The replication lag increases considerably when queries are performed on the StandBy database. I wonder if there is any setting that can be made to improve this performance. SNIP > Configuration PostgreSQL StandBy > > postgres.conf SNIP > hot_standby = on > hot_standby_feedback = on I've recently run into the same thing and it's a result of long running queries on the standby. Moving those queries to the master and / or fixing them to not run so long fixed out problem.