Re: idle_in_transaction_timeout - Mailing list pgsql-hackers

From David G Johnston
Subject Re: idle_in_transaction_timeout
Date
Msg-id 1401820365463-5805904.post@n5.nabble.com
Whole thread Raw
In response to Re: idle_in_transaction_timeout  (Vik Fearing <vik.fearing@dalibo.com>)
List pgsql-hackers
Vik Fearing wrote
> On 06/03/2014 03:30 PM, Abhijit Menon-Sen wrote:
>> At 2014-06-03 15:06:11 +0200, 

> vik.fearing@

>  wrote:
>>> This patch implements a timeout for broken clients that idle in
>>> transaction.
>> I think this is a nice feature, but I suggest that (at the very least)
>> the GUC should be named "idle_transaction_timeout".
> 
> I prefer the way I have it, but not enough to put up a fight if other
> people like your version better.
> 
>>> +        
> <para>
>>> +         Terminate any session that is idle in transaction for longer
>>> than the specified
>>> +         number of seconds.  This not only allows any locks to be
>>> released, but also allows
>>> +         the connection slot to be reused.  However, aborted idle in
>>> transaction sessions
>>> +         are not affected.  A value of zero (the default) turns this
>>> off.
>>> +        
> </para>
>> I suggest:
>>
>>     Terminate any session with an open transaction that has been idle
>>     for longer than the specified duration in seconds. This allows any
>>     locks to be released and the connection slot to be reused.
>>
>> It's not clear to me what "However, aborted idle in transaction sessions
>> are not affected" means.
>>
>>     The default value of 0 means that such sessions will not be
>>     terminated.
> 
> How about this?
> 
>     Terminate any session with an open transaction that has been idle
>     for longer than the specified duration in seconds. This allows any
>     locks to be released and the connection slot to be reused.
> 
>     Sessions in the state "idle in transaction (aborted)" occupy a
>     connection slot but because they hold no locks, they are not
>     considered by this parameter.
> 
>     The default value of 0 means that such sessions will not be
>     terminated.
> -- 
> Vik

I do not see any reason for an aborted idle in transaction session to be
treated differently.

Given the similarity to "statement_timeout" using similar wording for both
would be advised.

*Statement Timeout:*
"Abort any statement that takes more than the specified number of
milliseconds, starting from the time the command arrives at the server from
the client. If log_min_error_statement is set to ERROR or lower, the
statement that timed out will also be logged. A value of zero (the default)
turns this off.

Setting statement_timeout in postgresql.conf is not recommended because it
would affect all sessions."

*Idle Transaction Timeout:*

> Disconnect any session that has been "idle in transaction" (including
> aborted) for more than the specified number of milliseconds, starting from
> {however such is determined}.  
> 
> A value of zero (the default) turns this off.
> 
> Typical usage would be to set this to a small positive number in
> postgresql.conf and require sessions that expect long-running, idle,
> transactions to set it back to zero or some reasonable higher value.

While seconds is the better unit of measure I don't think that justifies
making this different from statement_timeout.  In either case users can
specify their own units.


Since we are killing the entire session, not just the transaction, a better
label would:

idle_transaction_session_timeout

David J.






--
View this message in context:
http://postgresql.1045698.n5.nabble.com/idle-in-transaction-timeout-tp5805859p5805904.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Hide 'Execution time' in EXPLAIN (COSTS OFF)
Next
From: Tom Lane
Date:
Subject: Re: Hide 'Execution time' in EXPLAIN (COSTS OFF)