Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pKptx-0007lT-2o for pgsql-admin@arkaria.postgresql.org; Thu, 26 Jan 2023 00:14:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pKptv-000661-TC for pgsql-admin@arkaria.postgresql.org; Thu, 26 Jan 2023 00:13:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pKptv-00065r-IZ for pgsql-admin@lists.postgresql.org; Thu, 26 Jan 2023 00:13:59 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pKptp-0007il-1k for pgsql-admin@lists.postgresql.org; Thu, 26 Jan 2023 00:13:58 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1pKptl-004mD2-Jc; Wed, 25 Jan 2023 19:13:49 -0500 Date: Wed, 25 Jan 2023 19:13:49 -0500 From: Bruce Momjian To: Scott Ribe Cc: Clive Swan , "pgsql-admin@lists.postgresql.org" Subject: Re: Long running queries Message-ID: References: <8299AF9E-0269-4F02-BC0D-D86D0D817D86@elevated-dev.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8299AF9E-0269-4F02-BC0D-D86D0D817D86@elevated-dev.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jan 25, 2023 at 10:57:58AM -0700, Scott Ribe wrote: > > On Jan 25, 2023, at 10:55 AM, Clive Swan wrote: > > > > SQL Server has a handy SQL "tool" to spot expensive and/or long running queries. > > > > Is there a similar query/tool for Postgresql?? > > - pg_stat_statements extension > - log_min_duration config parameter FYI, log_min_duration_statement will not print the duration until the query completes, so it is good for analysis later. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Embrace your flaws. They make you human, rather than perfect, which you will never be.