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 1qyyNc-00CRBV-72 for pgsql-general@arkaria.postgresql.org; Fri, 03 Nov 2023 17:54:48 +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 1qyyNZ-002BTF-7u for pgsql-general@arkaria.postgresql.org; Fri, 03 Nov 2023 17:54:45 +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 1qyyNY-002BT5-TC for pgsql-general@lists.postgresql.org; Fri, 03 Nov 2023 17:54:44 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qyyNR-003nds-Vu for pgsql-general@postgresql.org; Fri, 03 Nov 2023 17:54:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=UDGAq48cwyG02ocuUROrY4Un3T1DahTaHEb9OGanTXs=; b=OgfvX aqBfu3HiqOTyLsnDtZUtW+nVW7p4A/KmrD5JXPKf/hZZQt02edX2oNm6fULQ1rvabLyK0soTNng6W HUTNSq5d8+5n+nzN/8uIMFuSgXq7TRuJ5tXov1e6dz9w4ubnsnC5idWxJrhbfw4agkyprZUgoDMRY bF+vi8oggJaDjWYvMjEb0v9f6JZAAEnrYLCKyEZSqwup3ljR/HpdYIfWaSrMBMA9cILrJlLZvXrlP zF/fT0T1g90XNjmREiHKZBvlMj6/apvX/4WaSQAQGTZ2bnjZj5mzUWIJfZUjj96pPNaEGeYPG2KXk Z9ej4v8n9O6LsjdcUeOYyNJevuo8Q==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1qyyNQ-000Z9e-1X; Fri, 03 Nov 2023 13:54:36 -0400 Date: Fri, 3 Nov 2023 13:54:36 -0400 From: Bruce Momjian To: Adrian Klaver Cc: shashidhar Reddy , pgsql-general Subject: Re: Finding execution plan Message-ID: References: <42ac2198-ecb3-4a7e-a40d-d5f231c99e10@aklaver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42ac2198-ecb3-4a7e-a40d-d5f231c99e10@aklaver.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you.