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 1sAyUm-00DQY6-Np for pgsql-general@arkaria.postgresql.org; Sat, 25 May 2024 21:00: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 1sAyUm-000tW5-Nk for pgsql-general@arkaria.postgresql.org; Sat, 25 May 2024 21:00:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sAyUm-000tVx-9d for pgsql-general@lists.postgresql.org; Sat, 25 May 2024 21:00:04 +0000 Received: from mail-vs1-xe32.google.com ([2607:f8b0:4864:20::e32]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sAyUj-001ykc-GJ for pgsql-general@lists.postgresql.org; Sat, 25 May 2024 21:00:02 +0000 Received: by mail-vs1-xe32.google.com with SMTP id ada2fe7eead31-48a396f8f2cso879013137.0 for ; Sat, 25 May 2024 14:00:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716670800; x=1717275600; 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=uD0AgaOtx+yWpCBefI5wsDFgJiXYtAcoe9Ce+K3qhn0=; b=laAW4WzBEcJ3pqFm19GMAsFCvlelncVI1wlx7JbfeAzlB/SlOCk80JvkiEUkwxdHx9 dhmZuFHAFpdbcyq92pGNjtgfHnugxDm028tLLz56o4uBZ8nLn+qLTAX/v9Xgs1PJlTZg o+UjKTNdtzAnGmBMx5QN6h1ujGElMIXJYyFZ4TUKr//dR10LcEmu76pzWXSAea7f1Wi8 +sWR8hjTbCyuBodACrkdbgz51/EG0lVoFrkgIEr3/b/f5tofcMvNTSg+7BbVOkh6rJeR YZ0V6TJbK945qLRc/EVvUVoci9tlAFZRpae+5e8hZ/otOfqWmcatLzZ63bTSaT3wKUvV PmZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716670800; x=1717275600; 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=uD0AgaOtx+yWpCBefI5wsDFgJiXYtAcoe9Ce+K3qhn0=; b=WUn5Nn+p8LqCVO4woflogM4SR+DG6WxYZCFOxaksla7XpL7ZfmCjQZ3zkgbulhzrbQ DYtVuzqITDAPhnK5A3uVzTyP4sD1fOop5A43H2wsWjX3wvsZpYo8a+xg83tTVpE8tUSA JH+8KYoY2Lj10Smy+ZSyyjy0xtMO2SFmj3YKJ3ctUSs+JkV+ZhFVUHfuJLb7kzlStxFX BJAtVE0MXntE7NSbtwgsDcRtIpKlz/Lrxc2yGWZX0r6Pgn+SXMs/emHc46gCZEunjYIV DlxCcNvUdcEQfoFovJqa3tOtCVyomUNBCf5VPsgTtqqwcJavyH7Cntw4kdP4gOe7/2t+ kodw== X-Forwarded-Encrypted: i=1; AJvYcCWRJwZrMEFqqWcmc6+MkQyI9HYJSdz6zITq+brIScpOjeICz3KLwFyTG+5Be6jyZ1rxtCuNuiGTIJkdr/eMi7YS0gnIiCM7J47Lsm/uwDwwNB77 X-Gm-Message-State: AOJu0Yz+iMYFl3yQVt4qWCiylS7n0S0dV1evwChgrxa/GE4eqX1eeE1Q Sd1mriEiUKXlhMVgXfkXlQ+xn6m/MTHjdAdJ1AQse9E4y+jJJRBLH3Fl/WHObANtbadcaGllp6h LrooTM29jlJn84wdi4An1L4br3gI= X-Google-Smtp-Source: AGHT+IFDi21Z13dm/tm/VA9vIOAeTgvoAmQhE1BqB0Wwg6FVwWlsBYxKTaOwyJWQA6iANbEKe2USjY4q5XnqpsvpPAk= X-Received: by 2002:a05:6102:50a8:b0:47c:296c:5fe3 with SMTP id ada2fe7eead31-48a38543633mr5690457137.9.1716670800516; Sat, 25 May 2024 14:00:00 -0700 (PDT) MIME-Version: 1.0 References: <891bcfec74f7358ef0212caf6565a35153dd2941.camel@cybertec.at> In-Reply-To: From: sud Date: Sun, 26 May 2024 02:29:48 +0530 Message-ID: Subject: Re: Long running query causing XID limit breach To: yudhi s Cc: Laurenz Albe , pgsql-general Content-Type: multipart/alternative; boundary="00000000000042e04d06194d918e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000042e04d06194d918e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, May 26, 2024 at 2:24=E2=80=AFAM yudhi s wrote: > > > *hot_standby_feedback ON and max_standby_streaming_delay =3D -1:* > Ensures that long-running queries on the standby are not interrupted. The > primary waits indefinitely to avoid vacuuming rows needed by standby > queries. > But Can lead to significant replication lag and increased XID consumption > on the primary, potentially causing transaction ID wraparound issues. > > > *hot_standby_feedback OFF and max_standby_streaming_delay =3D -1:* > Ensures long-running queries on the standby are not interrupted. No > feedback is sent to the primary, reducing the risk of XID wraparound. > But The standby may fall significantly behind the primary, resulting in > high replication lag. > > > > *hot_standby_feedback ON and max_standby_streaming_delay =3D 14 seconds:* > The primary prevents vacuuming rows needed by standby queries, reducing > query cancellations on the standby. The replication lag is limited to 14 > seconds. > But Long-running queries on the standby that exceed 14 seconds may be > canceled, and the primary can still experience increased XID consumption. > > > *hot_standby_feedback OFF and max_standby_streaming_delay =3D 14 seconds:= * > Limits replication lag to 14 seconds and reduces XID consumption on the > primary. Queries on the standby exceeding 14 seconds are canceled. > but Long-running queries on the standby are more likely to be canceled du= e > to the lack of feedback to the primary. > > > Thank you so much. Does it mean that the last one we should go for i.e. (*hot_standby_feedback OFF and max_standby_streaming_delay =3D 14 seconds), *as because high availability is also a key requirement in any production environment, so keeping 14 seconds lag is kind of okay and also at the same time keeping hot_standby_feedback OFF will make sure the transaction id wraparound around won't happen because of any long running query on standby as it won't wait for the stand by feedback for vacuuming the tables. But i have one question here , does max_standby_streaming_delay =3D 14 , means the queries on the standby will get cancelled after 14 seconds? --00000000000042e04d06194d918e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Sun, May 26, 2024 at 2:24=E2=80=AFAM y= udhi s <learnerdatabase99= @gmail.com> wrote:

hot_standby_feedback ON and max_standby_streaming_delay =3D = -1:

Ensures that long-running queries on the standby are not int= errupted. The primary waits indefinitely to avoid vacuuming rows needed by = standby queries.
But Can lead to significant replication lag and increas= ed XID consumption on the primary, potentially causing transaction ID wrapa= round issues.

hot_standby_feedback OFF and max_standby_streaming_= delay =3D -1:

Ensures long-running queries on the standby are no= t interrupted. No feedback is sent to the primary, reducing the risk of XID= wraparound.
But The standby may fall significantly behind the primary, = resulting in high replication lag.


hot_standby_feedback ON an= d max_standby_streaming_delay =3D 14 seconds:

The primary preven= ts vacuuming rows needed by standby queries, reducing query cancellations o= n the standby. The replication lag is limited to 14 seconds.
But Long-ru= nning queries on the standby that exceed 14 seconds may be canceled, and th= e primary can still experience increased XID consumption.

hot_sta= ndby_feedback OFF and max_standby_streaming_delay =3D 14 seconds:
=C2=A0Limits replication lag to 14 seconds and reduces XID consumption on= the primary. Queries on the standby exceeding 14 seconds are canceled.
= but Long-running queries on the standby are more likely to be canceled due = to the lack of feedback to the primary.

=C2=A0=

Thank you so much.
=
Does it mean that the last one we should go for i.e. (hot_standby_f= eedback OFF and max_standby_streaming_delay =3D 14 seconds), as because= high availability is also a key requirement in any production environment,= so keeping 14 seconds lag is kind of okay and also at the same time keepin= g=C2=A0hot_standby_feedback OFF will make sure the transaction id wraparoun= d around won't=C2=A0happen because of any long running query on standby= as it won't wait for the stand by feedback for vacuuming the tables.

But i have one question here , does=C2=A0max_st= andby_streaming_delay =3D 14 , means the queries on the standby will get ca= ncelled after 14 seconds?
--00000000000042e04d06194d918e--