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 1surAo-00AjoP-4M for pgsql-general@arkaria.postgresql.org; Sun, 29 Sep 2024 10:29:06 +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 1surAl-00380Z-OS for pgsql-general@arkaria.postgresql.org; Sun, 29 Sep 2024 10:29:03 +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 1surAl-0037ur-Au for pgsql-general@lists.postgresql.org; Sun, 29 Sep 2024 10:29:03 +0000 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1surAh-001fIe-5M for pgsql-general@lists.postgresql.org; Sun, 29 Sep 2024 10:29:02 +0000 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-710fe5c3b44so2111163a34.0 for ; Sun, 29 Sep 2024 03:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727605738; x=1728210538; 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=JW3z8qVwjyU6IZxESSJfrlLmti4WOWXfOOs0YOGFQ/Y=; b=QJK5zbPIhwG8FszCS5VorvFNN4FkYz2MAWHNBr5aDARpg/wljx2O7Z6OxMLDOFwfK4 KZJvRUZjaFvUQqtSNb9GlzfFZWt+0+E6ehbE1LPXs2dg6EzOrLKrbsqYX9JvATfXfMsi 8tjCJOWeQoQNrSa2B1iiEHkGI/TFbl0SwcdRq9rDAl6MNHmA4EslSdg52O9mYJYc2dPa Tm8JB2orbB1Ktc+6R3FkvJsPjKotujwTLICIMKFlECZP03WT53ZjG/Fx/Hg/qHaYiLl/ DZfULMqAHrCRuI/KfJx8/PDzNLClZnkGhhHiBOC0QYtKylLK8q4AKWGbKLa5XZTWjw2Y XBMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727605738; x=1728210538; 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=JW3z8qVwjyU6IZxESSJfrlLmti4WOWXfOOs0YOGFQ/Y=; b=aAC/qkaPC8Q5K+Ikuh2XwLxhXA2yfMuNWXBDBelo5XSaqw1ju28Tjk7ZyXx/KVEyyK BISal7VIPR0Zk3ITCU9wf3fwrLUD4cO7kYEeOdzc8D++OLy0R2o5Bu0/+KQax07nYRnp i5Jn/4f257KTcqDgt+rbJiUz1FqC26nDtYwEeDmcJQOg9Eul8mr4lYS2GWvxUGVu5g1V XStu1jKTlSaUoQFIpNxnrgg1ylQxIbI0+XL8jQaJVwtjT2h+dXWnU5Tt8pxWgqrnrP7B KKSPlvUgOA0pHU/jwkFi+rXmnde0gWH9QsJvzmVZzlqXzb781GYkQI51rBh1W3/3rRf6 thGg== X-Gm-Message-State: AOJu0YxoDJWjTwnALfLGvZg9UnukWrOf9fBzq9OAg9HDj+JRmXuS3+T1 znIYY9qgmh0X50RMuKAdkei3dOHxgnBuikZ3Ug25+q+3o1RZDw5V3NEXJfzweiRF+g9pYSL5kk5 OtSdt4zrFNAqyV2Hi7C+gIPYPWxQ= X-Google-Smtp-Source: AGHT+IE7gsgtwGCSCN05xGufhJgVGCIBRsg/muHD/3w2FpO1acRe3TpU5tbLn8/TIF5eNP4QOzpPkWSXzCivszoqTsI= X-Received: by 2002:a05:6870:5487:b0:260:e678:b653 with SMTP id 586e51a60fabf-28710c00bb3mr5633589fac.42.1727605738487; Sun, 29 Sep 2024 03:28:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ramakrishna m Date: Sun, 29 Sep 2024 15:58:46 +0530 Message-ID: Subject: Re: Logical Replication Delay To: Greg Sabino Mullane , Justin Cc: pgsql-general@lists.postgresql.org, ravisql09@gmail.com Content-Type: multipart/alternative; boundary="0000000000005ac61806233f8e96" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000005ac61806233f8e96 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Justin and Greg, Thank you for your input and recommendations. We understand your point regarding separating the tables into different publications and subscriptions. However, due to certain business constraints, we are unable to implement this approach at the moment. *We are planning to set up logical replication from a standby to another server. When the primary goes down, there is no issue as the standby becomes the primary and the logical slots are already present. However, when the standby goes down, these slots are not copied to the third node or the primary by Patroni. Is there an option available to handle this scenario? * Regards, Ram. On Wed, 25 Sept 2024 at 20:12, Greg Sabino Mullane wrote: > On Sat, Sep 21, 2024 at 3:08=E2=80=AFPM Ramakrishna m wrote: > >> I would greatly appreciate any suggestions you may have to help avoid >> logical replication delays, whether through tuning database or operating >> system parameters, or any other recommendations >> > In addition to the things already answered: > > * What is the use case for logical replication? I assume your local > replicas are able to keep up just fine. > > * Check the nature of the work for problems, e.g. ORM doing > unnecessary/redundant updates, maintaining indexes that are not really > needed > > * Looks like your wal_segment_size was boosted to 1GB. What drove that > change? > > * Yes, autovacuum could affect things - make sure > log_autovacuum_min_durations is set > > Cheers, > Greg > > > --0000000000005ac61806233f8e96 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi Justin an= d Greg,
=
=
Thank you for your input and recommendations. We u= nderstand your point regarding separating the tables into different publica= tions and subscriptions.
However, = due to certain business constraints, we are unable to implement this approa= ch at the moment.

<= div>We are planning to set up logical replication fr= om a standby to another server. When the primary goes down, there is no iss= ue as the standby becomes the primary and the logical slots are already pre= sent. However, when the standby goes down, these slots are not copied to th= e third node or the primary by Patroni. Is there an option available to han= dle this scenario?=C2=A0

<= /font>
Regards,
Ram.


On Wed, 25 Sept 2024 at 20:12, Gr= eg Sabino Mullane <htamfids@gmail.= com> wrote:
On Sat, Sep 21, 2024 at 3:08=E2=80=AFP= M Ramakrishna m <ram.pgdb@gmail.com> wrote:

I would greatly= appreciate any suggestions you may have to help avoid logical replication = delays, whether through tuning database or operating system parameters, or = any other recommendations

In addition to = the things=C2=A0already answered:

* What is the us= e case for logical=C2=A0replication? I assume your local replicas are able = to keep up just fine.

* Check the nature of the wo= rk for problems, e.g. ORM doing unnecessary/redundant updates, maintaining = indexes that are not really needed

* Looks like yo= ur wal_segment_size was boosted to 1GB. What drove that change?
<= br>
* Yes, autovacuum could affect things - make sure log_autovac= uum_min_durations is set

Cheers,
Greg

=C2=A0

--0000000000005ac61806233f8e96--