Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sSVqj-007qmD-AZ for pgsql-general@arkaria.postgresql.org; Sat, 13 Jul 2024 06:03:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sSVqf-00EZfS-Mv for pgsql-general@arkaria.postgresql.org; Sat, 13 Jul 2024 06:03:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sSVqf-00EZfJ-Bh for pgsql-general@lists.postgresql.org; Sat, 13 Jul 2024 06:03:09 +0000 Received: from mail-yb1-xb32.google.com ([2607:f8b0:4864:20::b32]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sSVqd-001t5K-4Z for pgsql-general@lists.postgresql.org; Sat, 13 Jul 2024 06:03:08 +0000 Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-e04196b7603so2766617276.0 for ; Fri, 12 Jul 2024 23:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720850585; x=1721455385; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=qmLaOm1blMFK5kPj45A27zfUN62+PTYi9hs1Avy9ocA=; b=QrfG83uEUPBa4rl8MnSQQoRY9lNbD5vaD0LBOtsBLxBia94KDZA+NhQxn62h1qerBQ T/S4DsYavhI6OMVLGUQ+hF83cREqw3CP7IYL3H4lj1JMTiYIoal+lKrhEcw6iudgc3Cx hdGi/B55KbJRgojlsOZUnQEfLIfLP1tkG4RMR+zNh269SCHlr2yACaM6FxGqKzLzAdmI swHwG3oP3V1m/qAav3Frgcuf3FnfRlhZ0YvV9n6J/Z50j/KyV8cKhZOJPpWEzD9zxyDy qHVFA+C9FGlb3LQCshNeiRT7ZOtuVJYQbicc9kMRY88jMchV+dWeMCbFJIOwkw7lLQ15 rd/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720850585; x=1721455385; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qmLaOm1blMFK5kPj45A27zfUN62+PTYi9hs1Avy9ocA=; b=Bnknmj4H3rTNYe34qQrNH8doniVx/tSdjMJhMCCJSmC4evBilnMpCL14ghNXgYEFSN ncDkQUFU/ArsaXd4a7PZN1UkRUrrpVV/05dWXhwVwDdIKonYazXTOohuWCNbUfOeLplU +hb+iXbOAFckNMAhgNTF8oqy0aClr+HI29+4EjG7kQjHtuXCs8GC4tgAOWcRkexxcZ/x f0NPfUjazJKI6CbXqIqeEgnn2qhTVZBKQ0MLt/FeiPQLEdbEt6zz37pTB0NXw0WghcbO +XN/zA0KcgBrww2gDBtHvXo6Btc4aVZ26J8KEwNuegIGHsubYNwgsCVHlz2BedvSsCnN IHrg== X-Gm-Message-State: AOJu0Yx+J6kF3V6FD5J8lyC2uSP79EN0EWmuWkmClN3hh0DeOb98ckIt 4JY72TfbULxs//3CahQM9ZeIYGQ3rjwCCkvmFRko60lzQ7pLXxnRU9d6pnxdZ5E9gUq+siiBy6P dRx6KyCL2Vkn4wRgSGj+7D1Ycf9Y+xlGr X-Google-Smtp-Source: AGHT+IFYqdcAxKpBlvEdvtgMJl5VSNZwMG6ZumgLpmSuX0jOEg5YdmGYViLF26Lvh4/6KxQJOOiKg31JYFIVcFEEIwY= X-Received: by 2002:a25:1181:0:b0:dfd:e485:ca1f with SMTP id 3f1490d57ef6-e041b1210afmr15030720276.49.1720850585048; Fri, 12 Jul 2024 23:03:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Mukesh Tanuku Date: Sat, 13 Jul 2024 11:32:53 +0530 Message-ID: Subject: Re: Replication lag in Postgres To: Laurenz Albe Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000d55e60061d1abf96" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000d55e60061d1abf96 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you for the information Laurenz Albe On Fri, Jul 12, 2024 at 9:13=E2=80=AFPM Laurenz Albe wrote: > On Fri, 2024-07-12 at 20:41 +0530, Mukesh Tanuku wrote: > > I have a question with postgres HA setup. > > We are setting up a 2 node postgres cluster with async streaming > replication, we want to > > define a RPO (Recovery point objective) in case of primary failure. > > > > How can we best define the RPO in this setup? since it's an async > streaming replication > > setup there might be a chance of data loss which is proportional to the > replication delay. > > > > Is there any way we can configure the delay duration, like for example > to make sure every > > 10 mins the standby sync has to happen with primary? > > When there is a delay, it is usually because replay at the standby is > delayed. > The WAL information is still replicated. You won't lose that information > on > failover; it will just make the failover take longer. > > Unless you have a network problem, you should never lose more than a > fraction > of a second. > > Yours, > Laurenz Albe > --000000000000d55e60061d1abf96 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you for the information Laurenz Albe

On Fri, Jul = 12, 2024 at 9:13=E2=80=AFPM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
On Fri, 2024-07-12 at 20:41 +0530, Mu= kesh Tanuku wrote:
> I have a question with postgres HA setup.
> We are setting up a 2 node postgres cluster with async streaming repli= cation, we want to
> define a RPO (Recovery point objective) in case of primary failure.=C2= =A0
>
> How can we best define=C2=A0the RPO in this setup? since it's an a= sync streaming replication
> setup there might be a chance of data loss which is proportional to th= e replication delay.=C2=A0
>
> Is there any way we can configure=C2=A0the delay duration, like for ex= ample to make sure every
> 10 mins the standby sync has to happen with primary?=C2=A0

When there is a delay, it is usually because replay at the standby is delay= ed.
The WAL information is still replicated.=C2=A0 You won't lose that info= rmation on
failover; it will just make the failover take longer.

Unless you have a network problem, you should never lose more than a fracti= on
of a second.

Yours,
Laurenz Albe
--000000000000d55e60061d1abf96--