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 1u5XM5-0027XH-Fk for pgsql-admin@arkaria.postgresql.org; Thu, 17 Apr 2025 22:05:10 +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 1u5XM3-001ajl-C4 for pgsql-admin@arkaria.postgresql.org; Thu, 17 Apr 2025 22:05:08 +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 1u5XM2-001afl-R0 for pgsql-admin@lists.postgresql.org; Thu, 17 Apr 2025 22:05:07 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u5XLz-000dZ0-2G for pgsql-admin@lists.postgresql.org; Thu, 17 Apr 2025 22:05:07 +0000 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-306b6ae4fb2so1311730a91.3 for ; Thu, 17 Apr 2025 15:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=theoremasystems-com.20230601.gappssmtp.com; s=20230601; t=1744927502; x=1745532302; 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=R+CThM5jMwD6hHS66helb4c9K9U4p/ccKeqG8DJ23vo=; b=zoztlKvDz6D+V3cbxRWr5IfCiTEdUCXV0GM7TmE5a9DiI/VjFxzCAnOdfrl31Fpcwz 0k8Fo4WbORWUG1TXKf5HcgbfGqmohbwiZclg8x1nt5xqX5lBsbtNIsK5fDxQejHQTj0e 1dxyFXNzH6471DjZu+OeyBasPQFM0NjXbZ3PW13d2NnjpJqJpufouDx8WZ6lylRmsP6p jPhZ8hxCH6oUU8TeNDszH9iiXxxM4GDV10Bz/Pcsjn8QHPiTos5VzLkXA4R9z43mYKgE 0f9V/PpIqu9tR1pCXZtFw5oB9cfvOCyVHABXtv2UMJEsWhbEJQMRFH69/o+TEy6AaHep AiEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744927502; x=1745532302; 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=R+CThM5jMwD6hHS66helb4c9K9U4p/ccKeqG8DJ23vo=; b=qNGhcne5yMtELZOZ7vNFqNnr+L79nOiGKQqt+pUkdJ0fG5xeS52GGnAJax+LQmiNUL ftdZqw0OOnUYwh+dfIOZ+LZHPAgTDt4QHfGeaBGEZKmSwSHD4jwE8qeswTcauhzNIIYe D6QkxX/7Ub75PhLpLhSIOJJ0KmifCynW5ys+e90Naekjg4J75bg3LNza+0NAi7vBmEsi Af7Oh1UBwVxyWLXPDGUpw+uiZxhlNASuzbLceLl2H9xXrkTG2/6+egOQArNbM7Sj1WcI OxQdQicgZB3YEDLXssH4PIvIk863ldtD/9JZ/guwaqgMONiv9VddoivujOSB/HEOEPss QRuQ== X-Gm-Message-State: AOJu0Yxaf/YoH0jznQ/Y16x1sKLlYr0pdA7dUKH2nzwjBOdMYr2goVqT 323E+V4m0fghrR1AdgIwGauBNVLg+mj/xFCRCJOr+L+0vGWswvaxpwGDiRVul7rKw/G9+zsJUW1 Dj7wIJx9ttWg8GRAxeZvm6EIiOKe0LwBtlDkFoDTXl+41Oqrx X-Gm-Gg: ASbGnctZppYAUYtVy5cXrXiyGrWwXQ9ezRF51y6H3zzdn28syMspG9y7ekeHs0rdn07 7zzIf8TWxXH7XdMcotY3B+/cApKEEWpDa8e4uT6JxGcxZaHSlMXy6sCHlT+j3PrHTo1sGxMPdxt pLxf9J6HyvlkP4podA5O4i X-Google-Smtp-Source: AGHT+IHQo6RUJqtSPn8+Qp00TP3KvieS71OQlFLZGSmOM1XC4yXBsOqKpj7y7avndBX2umkBzhNwo99Hel9o/zgW12Q= X-Received: by 2002:a17:90b:384c:b0:2ff:4bac:6fba with SMTP id 98e67ed59e1d1-3087bbc29d0mr854029a91.24.1744927502097; Thu, 17 Apr 2025 15:05:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Gaspare Boscarino, P.Eng." Date: Thu, 17 Apr 2025 15:04:52 -0700 X-Gm-Features: ATxdqUG-7yrD4RQgoY_LlqJ_yjv0W-5tO4BCF8q4QeI9jz9BOwiAEbtstoJcrQ8 Message-ID: Subject: Re: Replication lag To: Wasim Devale Cc: Pgsql-admin , pgsql-admin Content-Type: multipart/alternative; boundary="000000000000ec04c606330097b6" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ec04c606330097b6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Wasim, If I understand your problem correctly, you are trying to use the replica to run queries for some kind of report. For those cases, I recommend setting up a logical replication which will allow you to have a replica that can be modified based on your needs. For instance, on the target database (replica) you could create indices to improve the performance of your query. An analysis of the execution plan would be necessary, of course= . Regards, Gaspare On Thu, Apr 17, 2025 at 5:15=E2=80=AFAM Wasim Devale w= rote: > Hi All > > Does wal_level =3D logical can resolve the issue of replication lag? > > On Thu, 17 Apr, 2025, 11:21=E2=80=AFam Wasim Devale, = wrote: > >> Hi everyone, >> >> We have a setup of primary and replica database. We are using the replic= a >> as read only purpose. But the queries are long running queries that take= s >> 30 minutes to complete. >> >> Do we have any settings in place that will not show replication lag and >> the queries also executes on replica database without competition on WAL >> reply? >> >> The settings: >> Hot standby is off >> And maximum streaming delay is set to -1 >> >> Thanks, >> Wasim >> > --=20 Gaspare Boscarino, P.Eng., M.Eng., MASc. Founder and CEO *Theorema Systems Inc.* www.theoremasystems.com | +1 604-765-0121 --000000000000ec04c606330097b6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Wasim,

If I understand= your problem correctly, you are trying to use the replica to run queries f= or some kind of report. For those cases, I recommend setting up a logical r= eplication which will allow you to have a replica that can be modified base= d on your needs. For instance, on the target database (replica) you could c= reate indices to improve the performance of your query. An analysis of the = execution plan would be necessary, of course.

= Regards,

=C2=A0=C2=A0 Gaspare

On Thu, Apr 17, 2025 at 5:15=E2=80=AFAM Wasim Devale <wasimd60@gmail.com> wrote:
Hi All= =C2=A0

Does wal_level = =3D logical can resolve the issue of replication lag?

On Thu, 17 = Apr, 2025, 11:21=E2=80=AFam Wasim Devale, <wasimd60@gmail.com> wrote:
Hi everyone,=

We have a setup of primary an= d replica database. We are using the replica as read only purpose. But the = queries are long running queries that takes 30 minutes to complete.

Do we have any settings in plac= e that will not show replication lag and the queries also executes on repli= ca database without competition on WAL reply?

The settings:
Hot standby is o= ff
And maximum streaming delay is set to -1

Thanks,
W= asim=C2=A0


--
Gaspare Boscarino, P.Eng., M.Eng., MASc.
Founder and CEO=
Theorema Systems Inc.
<= a href=3D"http://www.theoremasystems.com" target=3D"_blank">www.theoremasys= tems.com | +1 604-765-0121
--000000000000ec04c606330097b6--