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.98.2) (envelope-from ) id 1xJXxr-00000000HHK-2BJd for pgsql-general@arkaria.postgresql.org; Wed, 21 Oct 2026 15:10:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xJXxp-00000005rVk-0Zc1 for pgsql-general@arkaria.postgresql.org; Wed, 21 Oct 2026 15:10:49 +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.98.2) (envelope-from ) id 1xJXxo-00000005rVb-0i1u for pgsql-general@lists.postgresql.org; Wed, 21 Oct 2026 15:10:48 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xJXxk-00000000FW8-1KVA for pgsql-general@postgresql.org; Wed, 21 Oct 2026 15:10:47 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id BAE2A7A0043 for ; Wed, 21 Oct 2026 11:10:37 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Wed, 21 Oct 2026 11:10:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1792595437; x=1792681837; bh=WFq5xm2j0b35vP35TmtdpoOirpg0c1Uis6ESXRKpf1Y=; b= nVJJEs77RmdJXkFcL1/CIYFqdX1CT3DKWGrd+CA2H8ZbyFWEztqxqjPns1Bta8xf GdEhjKS57mZstLEvGukLYWqV4pza1kbu3WL7/7+6han0Ygvgtk28KAYttIfHhen0 QYYXHbSBSTx7BtNZSsrHQq1E1I0BKIwXZwcMx9iWnBS99KHmSbPaZQIsLMl9lxQP ++VrNoPaS0QfsmvNSSHSvOGaLBnB04gR4ty0PDol+5powkyratSeFcW0qPC41hgB e6RgmWJ/QWWKW+jBkJtbDYkswR6KFcTa3K8kknPXZ/RaO8h3dYgqzNfCXPOcregE FVtyktIxfxncUSIqafyH4g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1792595437; x= 1792681837; bh=WFq5xm2j0b35vP35TmtdpoOirpg0c1Uis6ESXRKpf1Y=; b=l NjPjbwQdByS2wtcmnI+wTVBYhIs3Z27jvXZls4X9QxA+3gt6i/kb3r2MZCVEJzxn FG5L3qrlEz9LMGEGfLptOGBJkylVCOEeVrgukC82VWbCx9NcWYTf/O/d8hODGKTE qE+rwjDGAzSfm1k72pq8TbLNHBOJ9nBrbB7cy4vQRjcTS/Boj5TR0lkiWhytez01 PJzOR+Fyj2L6kltT3477aY/PbaowgHBCeKzn6LcVmK9Lg0so1KlxhyYYX5iBaDz2 IBzdk3vEX4ro+cmmm3ymfmfV5sy7HBApYNPrB9edJ3xflgMZIkiNyuI4BR38NTTr LJo27+wxIHPphsi9MuXCg== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-07; repo=github.com/dkim2wg/interop; date=2026-10-18; sw=lmtpprox; action=sign d=aklaver.com a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1792595437; d=aklaver.com; mf=PGFkcmlhbi5rbGF2ZXJAYWtsYXZlci5jb20+; rt=PHBnc3FsLWdlbmVyYWxAcG9zdGdyZXNxbC5vcmc+; s=fm1:rsa-sha256:cFHZcNQATTm514ZGN9yFoo87zy/Y1u6P6WXG6bx1qnS4HRW XoDZOYjszk1TKutLiJtsVNjof5qXK+Cd/C7i0ov048gl0VMSo7Ew4ORFkZ0ifAXN J58YJ7jQQ1h3tzjlbZTH/SuCnUbzx8jfcpMvpja7yGat+UWSpni6MykYhnwyf67j DYp1nHC1WzUyK8lJ4QcadsCsPIW4tue5rYtHNRa5SbZO6o1hkioh1YCCIOf6ln2e kh2NaP6TecViyrSnD1l2nWza6Jv2LzVTWlIRLjaU+vUqoXgYKRjjsVjx2J6lRJYl xlOqrV5IrzKc2f5uAEubhUV6XmZEshPk2ue1NiQ==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-07; repo=github.com/dkim2wg/interop; date=2026-10-18; sw=lmtpprox; action=mi-m=1; hc=14; hn=cc,content-language,content-transfer-encoding,content-type, date,feedback-id,from,in-reply-to,message-id,mime-version, references,subject,to,user-agent; Message-Instance: m=1; h=sha256:HU1fYM2UMg9NQiGyZmiVp5iJbseDlVYn3wn2ZK2ayNk=:YMjxSv6Enb7nU5DVNl2tsbf7LwstFpYWzD4xPe5Dvrk=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFJdGTvWmUV4+dLabX8+mpO1Lltyp0T3hnOqG8Kxd9+/QU54RxGBoa5AMpGp3AmPg Q/fCWIDxYI4i4vt3f+ZwB7oxYR6LdPH3VVwYhIF/UUAtSexcCXCFtCBFdWfw3xlBCi001P 6au1iXNzzFRBa3L/blWX4s6vpxaqQEUcYkw998fL6HYAqoDaUnqhL7awUv7ClbsTQRZPlW FVE73FlwGm3YBwaaqhRu3UnZGGAOqXDS1DsmdPsaJ65bETT4h0yiXPNyX3wBN4mrzfRoiC 52t+gQkfGSvpy1fhdNlVd4Q49Bf3y6/T6YLpy7Zwo4nACFTLdEXM9TEHHuTJ7Xf25YwkPW Engtm2i7Y5+pFt2laVL3zhxk5EBa5YF+8ojGO20L7nLnAF5e7kMj2Cz26yU+QzloZsp1Jn jL3XzbTndkNltfdQolqzm2LBW3m30+7OvCBf8Rcrzlb90mWtjxhc/Rv4plrqz2ynqg4qfI DoZbAywHuld0ex2E0y+LBLAmuhygGoM4l/8fSFSUCbT+ok/GI/jeejCpLP/t15PHQ5SFJ+ rZaUzJxa9LznHRSVPmAMBWWnESJ4gAr4rrEPWXNPtJQeL9GGSW4CQXRxeUGRFAJh6wA0B1 zBcq539VwYswWZe35DPIfGedZZiogk/LMhZFBVCCBRfzMJ90VNkfOr0S5Ymw X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 21 Oct 2026 11:10:36 -0400 (EDT) Message-ID: <20030585-8ea9-4641-a81a-bd5dbb147260@aklaver.com> Date: Wed, 21 Oct 2026 08:10:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: RDS postgresql 17 function monitoring To: Brajendra Pratap Singh References: <1345505f-c13a-4d0c-971c-cad582a55c79@aklaver.com> Content-Language: en-US Cc: pgsql-general From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/21/26 1:47 AM, Brajendra Pratap Singh wrote: Reply to list also, in others word use Reply All Ccing list > Hi Adrian, > > Thanks for your response, Below are the asked details. > > Postgresql version : 17 > Procedural language: pl/pgsql > > We can't share the code due to security constraints but the flow is like > below. > > 1) We have 1st RDS postgresql instance where the actual data present > from multiple source databases hosts in different schemas based on > customer wise. > > 2) 2nd RDS postgresql instance from where the function gets executed and > connects to first RDS postgresql instance (both are on 17 version) via > FDW to fetch data customer wise created temporary table and perform > merge or can say multiple other transformation with the data fetched > from 1st host and available data already present in 2nd host where we > have table partitions based on customer and accordingly perform insert/ > update operations on target tables. > > 3) But the problem is as we have multiple customers and that function > ran customerwise at a time and then again 2nd means in loop so unable to > find like where it sticks in that function execution, where multiple > other functions also called out as I said for other transformation and > leggings. > > 4) Now the main moto is to find the function step where it's currently > running and taking time earlier or in future run to either log these > things or track down. A very basic example of one possible method: CREATE OR REPLACE FUNCTION public.notice_test() RETURNS void LANGUAGE plpgsql AS $function$ DECLARE rand_interval integer; BEGIN FOR i in 1..10 LOOP RAISE NOTICE 'Loop counter is %', i; RAISE NOTICE 'Time is %', clock_timestamp(); SELECT INTO rand_interval random(1, 10); RAISE NOTICE 'Random interval is %', rand_interval; PERFORM pg_sleep(rand_interval); END LOOP; END; $function$ ; test=# select notice_test(); NOTICE: Loop counter is 1 NOTICE: Time is 2026-10-21 08:06:21.784199-07 NOTICE: Random interval is 4 NOTICE: Loop counter is 2 NOTICE: Time is 2026-10-21 08:06:25.788436-07 NOTICE: Random interval is 4 NOTICE: Loop counter is 3 NOTICE: Time is 2026-10-21 08:06:29.793281-07 NOTICE: Random interval is 5 NOTICE: Loop counter is 4 NOTICE: Time is 2026-10-21 08:06:34.798375-07 NOTICE: Random interval is 1 NOTICE: Loop counter is 5 NOTICE: Time is 2026-10-21 08:06:35.79943-07 NOTICE: Random interval is 7 NOTICE: Loop counter is 6 NOTICE: Time is 2026-10-21 08:06:42.807301-07 NOTICE: Random interval is 1 NOTICE: Loop counter is 7 NOTICE: Time is 2026-10-21 08:06:43.808328-07 NOTICE: Random interval is 3 NOTICE: Loop counter is 8 NOTICE: Time is 2026-10-21 08:06:46.811336-07 NOTICE: Random interval is 4 NOTICE: Loop counter is 9 NOTICE: Time is 2026-10-21 08:06:50.815217-07 NOTICE: Random interval is 2 NOTICE: Loop counter is 10 NOTICE: Time is 2026-10-21 08:06:52.817121-07 NOTICE: Random interval is 7 notice_test > > Thanks, > BPratap > > > > > On Mon, 19 Oct 2026, 10:26 pm Adrian Klaver, > wrote: > > > > On 10/16/26 10:39 AM, Brajendra Pratap Singh wrote: > > Hi All, > > > > We need to monitor a function which is running since long to > understand > > at which step it is currently running and taking long time to > debug the > > function. > > > Postgres version > > Procedural language used? > > The function source or if that is something you do not want public, > then > a description of what the code does. > > Define how long a time it is taking. > > > > > Please suggest and let me know if any further information is > required. > > > > Thanks, > > BPratap > -- Adrian Klaver adrian.klaver@aklaver.com