From: Andres Freund <andres@2ndquadrant.com>
To: Magnus Hagander <magnus@hagander.net>
Cc: maxim.boguk@gmail.com, pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #10123: Weird entries in pg_stat_activity
Date: Thu, 24 Apr 2014 12:44:42 +0200
Message-ID: <20140424104442.GC16111@awork2.anarazel.de> (raw)
In-Reply-To: <CABUevEySW0ZrVbMzygnXGJ=E2UAewZu498bUN3VdjO1vjcd8xQ@mail.gmail.com>
References: <20140424101827.2714.39486@wrigleys.postgresql.org>
<CABUevEySW0ZrVbMzygnXGJ=E2UAewZu498bUN3VdjO1vjcd8xQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 2014-04-24 12:26:09 +0200, Magnus Hagander wrote:
> On Thu, Apr 24, 2014 at 12:18 PM, <maxim.boguk@gmail.com> wrote:
> > ]----+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > ts | 2014-04-24 13:49:03.498354+04
> > tx_age | 00:04:01.283106
> > change_age | 00:04:01.279373
> > datid | 16385
> > datname | *******
> > pid | 685
> > usesysid | 16384
> > usename | *******
> > application_name |
> > client_addr | 127.0.0.1
> > client_hostname |
> > client_port | 37461
> > backend_start | 2014-04-24 13:30:03.275711+04
> > xact_start | 2014-04-24 13:45:02.215248+04
> > query_start | 2014-04-24 13:45:02.215248+04
> > state_change | 2014-04-24 13:45:02.218981+04
> > waiting | f
> > state | idle
> > query |
> > | SELECT cache.save_response(
> > | *****
> > | );
> This sounds like the expected behavior. When state=Idle, the query field
> shows the value of the *last* query that ran. See
> http://www.postgresql.org/docs/9.3/static/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
> .
>
> Note that this was changed in 9.2, and at the same time the current_query
> field was renamed to query to highlight this change.
>
> The fact that xact_start shows something far in the past just means that
> there is an open transaction that has been open since then.
I don't think that's true. In that case the state should have been idle
in transaction, no?
I think there's a pgstat_report_xact_timestamp(0) missing from
xact.c:PrepareTransaction(). There's no point in reporting a prepared
xact's starttime in a backend that's not associated with it anymore.
Maxim, are you using prepared transactions?
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: andres@2ndquadrant.com, magnus@hagander.net
Subject: Re: BUG #10123: Weird entries in pg_stat_activity
In-Reply-To: <20140424104442.GC16111@awork2.anarazel.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox