Skip to content

Commit

Permalink
Update TCP keepalive docs
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Mar 11, 2018
1 parent 859747b commit c7d5a27
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/keepalive.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ backend (or network equipment) will interfere with these connections, it's bette
## TCP Keepalives

The keepalive mechanism above is ideal for long-standing idle connections, but it cannot be used during query processing. With some PostgreSQL-like data warehouse products such as [Amazon Redshift](http://docs.aws.amazon.com/redshift/latest/mgmt/welcome.html) or [Greenplum](http://greenplum.org/), it is not uncommon for a single SQL statement to take a long time to execute, and during that time it is not possible to send `SELECT NULL`. For these cases you may want to turn on *TCP keepalive*, which is quite different from the application-level keepalive described above. To better understand the different kinds of keepalives, see [this blog post](http://blog.stephencleary.com/2009/05/detection-of-half-open-dropped.html). As that article explains, TCP keepalive depends on networking stack support and might not always work, but it is your only option during query processing.

On Linux, you turn keepalives simply by specifying `Tcp Keepalive=true` in your connection string. The default system-wide settings will be used (for interval, count...) - it is currently impossible to specify these at the application level. On Windows, you can also specify `Tcp Keepalive Time` and `Tcp Keepalive Interval` to tweak these settings.

0 comments on commit c7d5a27

Please sign in to comment.