Re: Fwd: weird long time query - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Fwd: weird long time query
Date
Msg-id 5855.1576686643@sss.pgh.pa.us
Whole thread Raw
In response to Re: Fwd: weird long time query  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-bugs
hubert depesz lubaczewski <depesz@depesz.com> writes:
> On Thu, Dec 19, 2019 at 12:14:26AM +0800, Kaijiang Chen wrote:
>> BTW, I got the similar result (still see that proc) with "select * from
>> pg_stat_activity":
>> ...
>> state            | idle
>> ...
>> query            | DEALLOCATE pdo_stmt_00000388
>> 
>> Looks not very nice :-)

> not sure what you mean by not nice.

That's a feature not a bug (and yes, the behavior is documented).
People requested that the view continue to display the last query
of an idle session.  IIRC, the main argument was that otherwise
it's hard to tell apart a bunch of idle sessions.

If you don't like it, you can always do something like

case when state = idle then null else query end

            regards, tom lane



pgsql-bugs by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: Fwd: weird long time query
Next
From: Alexander Lakhin
Date:
Subject: Re: BUG #16161: pg_ctl stop fails sometimes (on Windows)