Re: Very long "<IDLE> in transaction" query

From: Thomas Markus <t(dot)markus(at)proventis(dot)net>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Very long "<IDLE> in transaction" query
Date: 2012-05-08 06:24:41
Message-ID: 4FA8BC29.7000305@proventis.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Gnanam,

I assume your not ending your transactions with commit or rollback. When
using a connection pooler your connection is reused for next request. So
if one request does something that initiates an implizit BEGIN (like an
UPDATE/INSERT) without a COMMIT or ROLLBACK this connection remains in
IDLE IN TRANSACTION mode. Please ensure that you invoke a COMMIT after
each successful request or ROLLBACK after failed or control these inside
your application. I'm not familiar with pgpool but check if you can
configure your pooler for this behaviour

Thomas

Am 03.05.2012 12:18, schrieb Gnanakumar:
> Hi,
>
> Recently, in our Production server, we found a "single query" being held up
> in "<IDLE> in transaction" for more than 19 hours using the following query:
> select date_trunc('second', current_timestamp - query_start) as runtime,
> datname as database_name, current_query from pg_stat_activity where
> current_query != '<IDLE>' order by 1 desc
>
> but we're clueless which was the root cause of this issue and still hunting.
> As we know, query output doesn't show up the actual query/statement.
<snip>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Gnanakumar 2012-05-08 06:52:58 Advice/guideline on increasing shared_buffers and kernel parameters
Previous Message Kevin Grittner 2012-05-07 17:09:49 Re: SQLSTATE 53100 could not extend file / disk full