Re: idle_in_transaction_timeout - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: idle_in_transaction_timeout
Date
Msg-id 53A224E6.9060608@agliodbs.com
Whole thread Raw
In response to Re: idle_in_transaction_timeout  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: idle_in_transaction_timeout  (Marko Tiikkaja <marko@joh.to>)
Re: idle_in_transaction_timeout  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: idle_in_transaction_timeout  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On 06/18/2014 02:52 PM, Bruce Momjian wrote:
> On Wed, Jun 18, 2014 at 04:41:30PM -0400, Robert Haas wrote:
>> The only problem I see is that it makes the semantics kind of weird
>> and confusing.  "Kill connections that are idle in transaction for too
>> long" is a pretty clear spec; "kill connections that are idle in
>> transaction except if they haven't executed any commands yet because
>> we think you don't care about that case" is not quite as clear, and
>> not really what the GUC name says, and maybe not what everybody wants,
>> and maybe masterminding.
> 
> "Kill connections that are idle in non-empty transaction block for too
> long"

Here's the POLS violation in this:

"I have idle_in_transaction_timeout set to 10min, but according to
pg_stat_activity I have six connections which are IIT for over an hour.What gives?"

Robert's right, not killing the "BEGIN;" only transactions is liable to
result in user confusion unless we label those sessions differently in
pg_stat_activity. Tom is right in that killing them will cause some
users to not use IIT_timeout when they should, or will set the timeout
too high to be useful.

So it seems like what we should do is NOT call sessions IIT if they've
merely executed a BEGIN; and not done anything else.  Then the timeout
and pg_stat_activity would be consistent.

Counter-argument: most app frameworks which do an automatic BEGIN; also
do other stuff like SET TIMEZONE each time as well.  Is this really a
case worth worrying about?

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Jsonb: jbvBinary usage in the convertJsonbValue?
Next
From: Marko Tiikkaja
Date:
Subject: Re: idle_in_transaction_timeout