Re: Possible causes of high_replay lag, given replication settings? - Mailing list pgsql-general

From Nick Cleaton
Subject Re: Possible causes of high_replay lag, given replication settings?
Date
Msg-id CAFgz3ksSB1OvN1ONDOO2qvhhF-FS7PXQTQtkDQYP_Y_pcvf+6g@mail.gmail.com
Whole thread Raw
In response to Possible causes of high_replay lag, given replication settings?  (Jon Zeppieri <zeppieri@gmail.com>)
Responses Re: Possible causes of high_replay lag, given replication settings?
List pgsql-general
On Fri, 18 Jul 2025 at 21:29, Jon Zeppieri <zeppieri@gmail.com> wrote:
>
> I just had a situation where physical replication fell far behind
> (hours). The write and flush lag times were 0, but replay_lag was
> high. The replica has hot_standby_feedback on, and both
> max_standby_streaming_delay and max_standby_archive_delay are set to
> 30s.
>
> What could cause a situation like this? If the network were a problem,
> I'd expect the other _lag times to be high. So it appears that the
> replica was getting the WAL but was unable to apply it. Are there
> situations where the replica cannot apply WAL other than the kinds of
> conflicts that would be addressed by the _delay settings?
>
> I checked pg_stat_database_conflicts, but there was nothing in it -- all zeros.

This can happen when there are several busy writing processes on the
primary. The single replay process on the replica can't keep up with
the writes.



pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Is there any limit on the number of rows to import using copy command
Next
From: "sivapostgres@yahoo.com"
Date:
Subject: Re: Is there any limit on the number of rows to import using copy command