Re: keep alive and running query - Mailing list pgsql-admin

From Albe Laurenz
Subject Re: keep alive and running query
Date
Msg-id A737B7A37273E048B164557ADEF4A58B17C839D2@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to keep alive and running query  (desmodemone <desmodemone@gmail.com>)
Responses Re: keep alive and running query  (desmodemone <desmodemone@gmail.com>)
List pgsql-admin
desmodemone wrote:
> As I tested and saw until now, the keep alive functions as follow [if I understand correctly and it's
> not a bug] :
> 
> When a connection it's in idle state or in idle in transaction, if the connection with client it's
> broken  for a number of keep alive, the backend will be terminated.
> 
> 
> By the way if this could be ok in an OLTP enviroment, because the average time of a query is << the
> time of keep alive,  in a DWH enviroment could be a problem.
> 
> Imagine your application server, where there is an ETL, will go down for 1 minute and your
> transactions are still running on the DWH database, that transactions could run for hours before the
> 
> keep alive will terminate them, because they are in transaction state and not idle or idle in
> transaction.

TCP keepalive will also terminate a session that is currently
stuck in a long running SQL query if the client end dies.

I think that your problem is that you mix up different meanings of "idle".

In PostgreSQL, a connection is idle (or idle in transaction) if processing
of the last command is finished and the server is waiting for the next
command from the client.

In TCP, a connection is idle if there is no network traffic.

Yours,
Laurenz Albe

pgsql-admin by date:

Previous
From: desmodemone
Date:
Subject: keep alive and running query
Next
From: desmodemone
Date:
Subject: Re: keep alive and running query