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 1to0W5-004jx9-5q for pgsql-general@arkaria.postgresql.org; Fri, 28 Feb 2025 13:35:02 +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 1to0W6-006O4f-0V for pgsql-general@arkaria.postgresql.org; Fri, 28 Feb 2025 13:35:00 +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 1to0W5-006O4X-M8 for pgsql-general@lists.postgresql.org; Fri, 28 Feb 2025 13:35:00 +0000 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1to0W0-000BFV-34 for pgsql-general@postgresql.org; Fri, 28 Feb 2025 13:34:59 +0000 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-2b38896c534so1149253fac.0 for ; Fri, 28 Feb 2025 05:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740749695; x=1741354495; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=ttlXBXjkbAAuS4b4Xc2/60g07Mn3UXlKZeHdGlCqmPI=; b=NGvcLofis5UXYpjQN12uRntt8KjGzzB3MTcbMOqJhYvcN2bF7o7M5qgqirVxAVpcZA TXDCJRK9fxytK1p+UKUTLcv49KonYpW4DCS1uKAI+7+9anHXB1XuH/a2IFSbbXHw0hu6 1tuM4veWRlzNdwhvUYIrCSQGMt1SUOkHIysDEgPdt9wS1cdKvMDMIzsJMEGVUQK96tq8 Y2m8P51qncaxL1yIwRechrVznbyV+9i/CFFlhBi+6XgDJN8LVpdpPZjuQLLZ5QbV/2Rn D6jejW4ZjCbqMSOMcNP0f1JQytEHyeqT3ZOUC0wJIOvT5A7eMExiaW96UKTj9GRghWw+ nvWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740749695; x=1741354495; h=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=ttlXBXjkbAAuS4b4Xc2/60g07Mn3UXlKZeHdGlCqmPI=; b=orU8uXukTbyj0mdNBM3d6dcJN7QwVuywKF5Z+XBkQzxYLB/UeDsdBeCFOfGJl0HBJ9 Xed+t7lcyD70lKNxN5PFqWIrJDtVGX+W7H3qcHbcxahPQpYRxu1jNm8YXA+UtNs2Yqnz bZp4skD2WYmV0rqLsAgQgDl7FtUMeRJ1uA3hBXDyrOtNv3LsIu4mmI4OiiDtNNj2xt26 SHv3qgnG0T+dzbLz1doQMTrKPUZPsE29Pj4zTjMdtcFBiIBvuCz3CPT0AoyQeb+Wftng jkL3PPtEBLwhAamDv1+NYUwy8lPNFVzoD4iIYnzCCHYHvHOhOUexUNXs8tP8u8H0gQoW Fc9g== X-Gm-Message-State: AOJu0Yy0fI4L/5ioAdKg4DuYW4sh5Q9rSZyOD418lDHTxgkjvR4v4hNC KgNStgEliTnZogVCaJpzrV+OIZCekXZVK8fDsxzeU8tC8vLso8Yhqwq5vpz94d0pw0cvHi9C7hL 5m33o6laJbOOKij7TMRu9YDMgcWz5Lg== X-Gm-Gg: ASbGnctW6nTWDPjp+TSRUw8K+sort6yO/308c3F9AXXls+hsA5q8rnAmExB4aZ/TfyS /v678InFLIWZuhUO6Iltxi86l2UIw+2+NGGtDxnWXNcgihaWIQcQOfaNyaHyUOC9pI/zpDWfbLL Lwfy1wvEpN1BjRmv5PAZ656wdtbtAerG+3JsHKcj84Hw== X-Google-Smtp-Source: AGHT+IGNVwNAyakzYtyVdmtfV8adiRDMSC6DSXUG9Es2U4hlw9rYbRJL5RYPLzeWQ0AFjHsCMlQXjG+x80VQOyhXeOk= X-Received: by 2002:a05:6870:de11:b0:29e:1325:760a with SMTP id 586e51a60fabf-2c1782be8cdmr1964300fac.8.1740749695578; Fri, 28 Feb 2025 05:34:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Fri, 28 Feb 2025 08:34:44 -0500 X-Gm-Features: AQ5f1JofzGSd54LuNZO_7UfAkw18K7xPVF3WoKOVgOhLCLq0CfeoAJVWquTB54s Message-ID: Subject: Re: Long Running query and trace potential issues To: pgsql-general Content-Type: multipart/alternative; boundary="0000000000003f7d97062f33df7e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003f7d97062f33df7e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Feb 28, 2025 at 6:50=E2=80=AFAM KK CHN wrote: > List > > postgres=3D# SELECT PID, now() - pg_stat_activity.query_start AS duration= , > query, state FROM pg_stat_activity WHERE (now() - pg > _stat_activity.query_start) > interval '5 minutes' AND state =3D 'active'= ; > pid | duration | query > | state > > ------+-------------------------+----------------------------------------= --+-------- > 3957 | 17 days 12:00:30.782583 | START_REPLICATION B5/EE000000 TIMELINE = 1 > | active > (1 row) > postgres=3D# > > Postgres 16 and pgbackrest 2.52.1 on RHEL 9.4 > > Is this a potential issue ? > Only if you don't want to be replicating to a standby server. > It has been running for 17 days . ( I have configured WAL replication to > a standby server and pgbackrest to a remote server ) is this normal > running 17 days START_REPLICATION B5/EE000000 TIMELINE1 active ? > Select more columns, like username,client_hostname and client_addr. You started replicating to the standby server 17 and a half days ago. This is how PG replicates to the standby server. > Any hints to further trace where the query is executing, what it's > trying to perform, how to optimize if this is not normal ? Any guidance i= s > much appreciated.. > It's certainly normal if you want to replicate to a standby server. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --0000000000003f7d97062f33df7e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Feb 28, 2025 at 6:50=E2=80=AFAM K= K CHN <kkchn.in@gmail.com> = wrote:
List=C2=A0

postgres=3D#=C2=A0SELECT PID, now() - pg_stat_activi= ty.query_start AS duration, query, state FROM pg_stat_activity WHERE (now()= - pg
_stat_activity.query_start) > interval '5 minutes' AND = state =3D 'active';
=C2=A0pid =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2= =A0duration =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0query =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 | state
------+-------------------------+------= ------------------------------------+--------
=C2=A03957 | 17 days 12:00= :30.782583 | START_REPLICATION B5/EE000000 TIMELINE 1 | active
(1 row)postgres=3D#

Postgres 16 and pgba= ckrest 2.52.1 on RHEL 9.4

=C2=A0 Is this a potenti= al issue ?

Only if you don'= t want to be replicating to a standby server.
=C2=A0
It has be= en running for 17 days .=C2=A0 ( I have configured=C2=A0WAL replication to = a standby server and pgbackrest to a remote server )=C2=A0 is this=C2=A0 no= rmal running 17 days START_REPLICATION B5/EE000000 TIMELINE1 active ?=C2=A0= =C2=A0

Select more columns, li= ke username,client_hostname and client_addr.

You s= tarted replicating to the standby server 17 and a half days ago. This is ho= w PG replicates to the standby server.
=C2=A0
Any hints=C2=A0 t= o further trace=C2=A0 where the query is executing, what it's trying to= perform, how to optimize if this is not normal=C2=A0? Any guidance is much= appreciated..

It's certain= ly normal if you want to replicate to a standby server.

--
Death to <Redacted>, and= butter sauce.
Don't boil me, I'm still alive.
<= ;Redacted> lobster!
--0000000000003f7d97062f33df7e--