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 1qyyPG-00CRKR-5z for pgsql-general@arkaria.postgresql.org; Fri, 03 Nov 2023 17:56:30 +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 1qyyPE-002EQa-QQ for pgsql-general@arkaria.postgresql.org; Fri, 03 Nov 2023 17:56:28 +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 1qyyPE-002EQR-FL for pgsql-general@lists.postgresql.org; Fri, 03 Nov 2023 17:56:28 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qyyPB-004WzN-Ot for pgsql-general@postgresql.org; Fri, 03 Nov 2023 17:56:27 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id BC8145C01BD; Fri, 3 Nov 2023 13:56:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 03 Nov 2023 13:56:24 -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:sender:subject:subject:to:to; s=fm2; t= 1699034184; x=1699120584; bh=s0KDh0xw54vKIWPAFkCOMMcm+xwOThk2J/S P2jRtRxo=; b=bBglPqYJJ6E6A1nlhgaxR+XDGqHEXtNYJmdmxS8JIGyupNhHWpN VIzxBUKT3f1HnAqBmO/7YzZFdj0qJ/UVrwHnT6/BoohfbSuebgcOW4tfYrlOgXWY mbneS4gX7t5INKW+T2cRK0Yg04tARqRTNmcgUVUpn4RSQ/oEbvsJnpG3dBAuCkht u3BPSJhHP2HTbrc6oI9gpsdNYg/9Wkdh3n+mHT7TbJDVBMLtYeuVg+ro6OcDBUGP JUQYD+yPaRsovP5+/Uqp3q6O2bQukE+Yk5j/MquXuWO0RjCa4JbrDfdMaLms91d1 aWqAjeOFg76Tk5b9P0IYbrDZJCKoRoSF+CA== 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:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1699034184; x=1699120584; bh=s0KDh0xw54vKIWPAFkCOMMcm+xwOThk2J/S P2jRtRxo=; b=CV5c44JK9SS0BrYUMFYkjrW38Kcf8MYkd2mPbgp7AtVDSULlDuu 0v2O0tlEV7qj3qwUEfzA8C6ppEAIrmLIl9G67UBM2hEWoXuRhrec418HLddv0tFP ECJYDu3tkZ/dzZeRUX3E+37ERQrDsF9VdEGi38xxmSzeNCeSCERcWs9mUzXSA+Y8 u3a6kLV19Tq1W4mXuuyXKPejhc1CPbfuKKJRKstCqr+8jvAB8wIoviY7nlawYjPC YbeGLcyb+Wvb0/NvWKn3mdNM9+RqCC/JhBGCo/Byw4mFKf0sXY7tVgUHdkqB7TD3 Wp4xj8388Gw+CM/4DG2Jws6SLUNwy0VsW3w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddtkedguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomheptegu rhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrd gtohhmqeenucggtffrrghtthgvrhhnpeeuudefjeejgffgtddtgeehgfekueevkeekieet tedtkeffheeivdethfevffegueenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorh hgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggu rhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 Nov 2023 13:56:23 -0400 (EDT) Message-ID: <5e5bc083-0bf6-41f0-baad-0636a02b5ab9@aklaver.com> Date: Fri, 3 Nov 2023 10:56:22 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Finding execution plan Content-Language: en-US To: Bruce Momjian Cc: shashidhar Reddy , pgsql-general References: <42ac2198-ecb3-4a7e-a40d-d5f231c99e10@aklaver.com> From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/3/23 10:54 AM, Bruce Momjian wrote: > On Fri, Nov 3, 2023 at 10:44:12AM -0700, Adrian Klaver wrote: >> On 11/3/23 10:40 AM, shashidhar Reddy wrote: >> >> Hello All, >> >> I have a Postgresql function scheduled to run on the database, some tines >> it is taking too long than usual time, is it possible to get the execution >> plan of this function or any other way to troubleshoot >> >> >> You might to take a look at the contrib module: >> >> >> https://www.postgresql.org/docs/current/pgstatstatements.html >> >> >> "The pg_stat_statements module provides a means for tracking planning and >> execution statistics of all SQL statements executed by a server." > Since he asked about execution plans, I was thinking auto_explain: > > https://www.postgresql.org/docs/current/auto-explain.html Yeah, that would be the better option.