Re: Currently running queries with actual arguments?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: rihad <rihad(at)mail(dot)ru>
Cc: Garfield Lewis <garfield(dot)lewis(at)lzlabs(dot)com>, pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Currently running queries with actual arguments?
Date: 2021-10-07 18:47:19
Message-ID: 20211007184718.GD5476@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

If only the physical world exists, free will is an illusion.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2021-10-07 18:54:46 Re: Regression in PL/PGSQL code using RETURN QUERY with Postgres 14
Previous Message Gavin Roy 2021-10-07 18:38:02 Regression in PL/PGSQL code using RETURN QUERY with Postgres 14