Re: Meaning of query age in pg_stat_activity - Mailing list pgsql-general

From Jan De Moerloose
Subject Re: Meaning of query age in pg_stat_activity
Date
Msg-id CAF06xsSczrCnPxoAmhOxbU4QN5K-iLtbmF_Ew=zB0S4Z_gg-zA@mail.gmail.com
Whole thread Raw
In response to Re: Meaning of query age in pg_stat_activity  (Nikolay Samokhvalov <samokhvalov@gmail.com>)
Responses Re: Meaning of query age in pg_stat_activity
List pgsql-general
So the query is just the latest query and the time is the transaction time since this query, i suppose ?
Thanks for your answer, i will try to make the transaction shorter as you suggest.

On Tue, Jan 30, 2018 at 12:29 AM, Nikolay Samokhvalov <samokhvalov@gmail.com> wrote:
On Mon, Jan 29, 2018 at 3:19 PM, Jan De Moerloose <jan@sensolus.com> wrote:
The state is 'idle in transaction'.

So you have long-running *transactions*, not queries. This is not good for an OLTP system, because some transaction can wait of others, which are "idle in transaction" but do nothing at the moment. Think how you can make them shorter, commit faster.

Also, if your server version is 9.6+ consider setting idle_in_transaction_session_timeout to some low value:


pgsql-general by date:

Previous
From: Nikolay Samokhvalov
Date:
Subject: Re: Meaning of query age in pg_stat_activity
Next
From: PT
Date:
Subject: Re: best way to storing logs