pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Lucas <root@sud0.nz>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: PostgreSQL 9.2 high replication lag
Date: Fri, 20 Aug 2021 07:29:38 +0200
Message-ID: <4b9178e5ffeb33e7f6409f204846053623fc280a.camel@cybertec.at> (raw)
In-Reply-To: <dbclXiXfYM-35Y3aYg0uIEi_f1uBN6AxCoKREZEaPkls96w5hlhwShonrsh8J9Vjr26yO2XrN1KzVgreE2jxsj7l6Bb0gr_CFS-21JsXTb8=@sud0.nz>
References: <Z14WgPUs_T-sranXV8i1KakN-eGRgP7fFcKUR8wHJDmjR-V8tHXkIIVWPxEEUd69GBeQCCKD0BeFn4f9AKItYa22mk_DzQP0yKuhRoyXZCc=@sud0.nz>
	<B5g7l_o95sxd3u10ZW9YbVYupwvDDpGNz9EWJSmvBkSRSIPhExkEokHVe-bLHr8qQ1FVllhKA03L94NJrZ-iSTMC31TrFAzKN-aGPt4gy-g=@sud0.nz>
	<CAKFQuwayvL=PLFu=UxV5pBakJfiwLyqp33_cSc+VNb2UOS_q1w@mail.gmail.com>
	<0d5784f69c8f3b61523917b7ee5ea12a042bf478.camel@cybertec.at>
	<QFb7j4p_XYj8LIp-WyvRMyUKbzrZaLwb7mXmhx4VSqMtYMUlUkh6hyiBsWW86AwWEwpTEfMSeaFz9ct0GNksS3DSvDK4LWc8-pKPerUPHg0=@sud0.nz>
	<RU6H0W6rPBEtSJyCna38pN176ut44rL1OHkHOCv4ZRTGyCLqnNZ2WiNweHP4EHWoCUPGlI-52p8EwZMfGQCAcp_von52j-D8dSQ53oUXpH4=@sud0.nz>
	<CAKoxK+7GWav4HDwCrNCg33_TsrjERHq49CunwxRyALTofYUjPg@mail.gmail.com>
	<CAOFEiBdttmeyPznfXWOvKe40gy9X2n2DzWbWe9M-vAt4FBfZyw@mail.gmail.com>
	<9IUyTDCTXb7OhMjGR1ng9s6dxMnIilFs9w0rdKEQWOhWB0SWt-GqiJML-YNZadtZrnppAp0B5aCpY3HZcWvWSMrGEFOLIncUtj2BYm8qOUs=@sud0.nz>
	<dbclXiXfYM-35Y3aYg0uIEi_f1uBN6AxCoKREZEaPkls96w5hlhwShonrsh8J9Vjr26yO2XrN1KzVgreE2jxsj7l6Bb0gr_CFS-21JsXTb8=@sud0.nz>

On Fri, 2021-08-20 at 01:33 +0000, Lucas wrote:
> After setting max_standby_streaming_delay to 120s it got a lot better.
>  But the replication delay is still happening quite often, except this time goes up to 120s only.

That's exactly what this parameter should do.

If you don't want the delays, either reduce the value (and get more canceled queries)
or try to reduce the number of conflicts, for example by setting "hot_standby_feedback = on".

Note that you will never be able to completely get rid of replication colflicts;
for example, there are buffer pin conflicts or lock conflicts caused by autovacuum
truncation.

See this article for more:
https://www.cybertec-postgresql.com/en/streaming-replication-conflicts-in-postgresql/

If you want a standby that has no apply delays and no canceled queries is usually
not possible.  Consider using two standby servers for these two purposes.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (14+ messages)  latest in thread

Message-ID: <4b9178e5ffeb33e7f6409f204846053623fc280a.camel@cybertec.at>
Permalink:  ../4b9178e5ffeb33e7f6409f204846053623fc280a.camel@cybertec.at/
Also on:    postgresql.org/message-id/4b9178e5ffeb33e7f6409f204846053623fc280a.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, root@sud0.nz
  Subject: Re: PostgreSQL 9.2 high replication lag
  In-Reply-To: <4b9178e5ffeb33e7f6409f204846053623fc280a.camel@cybertec.at>
  References: <Z14WgPUs_T-sranXV8i1KakN-eGRgP7fFcKUR8wHJDmjR-V8tHXkIIVWPxEEUd69GBeQCCKD0BeFn4f9AKItYa22mk_DzQP0yKuhRoyXZCc=@sud0.nz> <CAKFQuwayvL=PLFu=UxV5pBakJfiwLyqp33_cSc+VNb2UOS_q1w@mail.gmail.com> <0d5784f69c8f3b61523917b7ee5ea12a042bf478.camel@cybertec.at> <QFb7j4p_XYj8LIp-WyvRMyUKbzrZaLwb7mXmhx4VSqMtYMUlUkh6hyiBsWW86AwWEwpTEfMSeaFz9ct0GNksS3DSvDK4LWc8-pKPerUPHg0=@sud0.nz> <RU6H0W6rPBEtSJyCna38pN176ut44rL1OHkHOCv4ZRTGyCLqnNZ2WiNweHP4EHWoCUPGlI-52p8EwZMfGQCAcp_von52j-D8dSQ53oUXpH4=@sud0.nz> <CAKoxK+7GWav4HDwCrNCg33_TsrjERHq49CunwxRyALTofYUjPg@mail.gmail.com> <CAOFEiBdttmeyPznfXWOvKe40gy9X2n2DzWbWe9M-vAt4FBfZyw@mail.gmail.com> <9IUyTDCTXb7OhMjGR1ng9s6dxMnIilFs9w0rdKEQWOhWB0SWt-GqiJML-YNZadtZrnppAp0B5aCpY3HZcWvWSMrGEFOLIncUtj2BYm8qOUs=@sud0.nz> <dbclXiXfYM-35Y3aYg0uIEi_f1uBN6AxCoKREZEaPkls96w5hlhwShonrsh8J9Vjr26yO2XrN1KzVgreE2jxsj7l6Bb0gr_CFS-21JsXTb8=@sud0.nz> <4b9178e5ffeb33e7f6409f204846053623fc280a.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox