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 1mYYQP-00051y-JM for pgsql-general@arkaria.postgresql.org; Thu, 07 Oct 2021 18:47:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mYYQO-0006Mt-Id for pgsql-general@arkaria.postgresql.org; Thu, 07 Oct 2021 18:47:24 +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 1mYYQO-0006Ml-9n for pgsql-general@lists.postgresql.org; Thu, 07 Oct 2021 18:47:24 +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 1mYYQM-0003Dv-1v for pgsql-general@postgresql.org; Thu, 07 Oct 2021 18:47:23 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1mYYQJ-0000ct-0W; Thu, 07 Oct 2021 14:47:19 -0400 Date: Thu, 7 Oct 2021 14:47:19 -0400 From: Bruce Momjian To: rihad Cc: Garfield Lewis , pgsql-general General Subject: Re: Currently running queries with actual arguments? Message-ID: <20211007184718.GD5476@momjian.us> References: <12669af6-901c-4b7f-834b-e17cf99e94df@mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Sep 23, 2021 at 08:51:49PM +0400, rihad wrote: > On 9/23/21 7:58 PM, Garfield Lewis wrote: > > The way I normally get this info is by setting the following: > > > > log_statement = 'all' > > > > then the arguments will be printed in the postgres.log file. There could be some other way but that is what I know. > > > > Thanks, those queries are logged after their completion, but I specifically > need the list of unfinished long queries currently being executed. Uh, log_statement prints them before they are executed --- log_min_duration_statment prints them after execution. You can verify this by running: SET log_statement = 'all'; SELECT pg_sleep(430); and then looking in the log file. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.