title: PostgreSQL - tcp_keepalives_idle - explanation needed
body: <p>I am reading the PostgreSQL docs on this parameter tcp_keepalives_idle. </p>
  
  <blockquote>
    <p>tcp_keepalives_idle (integer) </p>
    
    <p>Specifies the number of seconds of inactivity after which TCP should send a keepalive message to the client. A value of 0 uses the system default. This parameter is supported only on systems that support TCP_KEEPIDLE or an equivalent socket option, and on Windows; on other systems, it must be zero. In sessions connected via a Unix-domain socket, this parameter is ignored and always reads as zero.</p>
  </blockquote>
  
  <p>Questions: </p>
  
  <p>1) What does that TCP_KEEPIDLE exactly mean? I find it in some Linux man pages but don't quite understand it. Which systems support TCP_KEEPIDLE and which not? </p>
  
  <p>2) What does "sessions connected via a Unix-domain socket" mean? I have PostgreSQL server in AWS (RDS) and sessions connect to it from various OSs
  (Windows, Linux, etc.). So... what does that socket thing mean?   </p>
  
  <p>Note that this question is related to my other question here </p>
  
  <p><a href="https://stackoverflow.com/questions/55972569/postgresql-queries-not-killed-on-app-server-shutdown">PostgreSQL queries not killed on app server shutdown</a> </p>
  
  <p>in which I got some suggestions to look at and try to use tcp_keepalives_idle.</p>
  
  <p>So... <code>tcp_keepalives_idle</code> is set to 300 (secs) in my system, but some queries continue to run even for a longer time after the client who initiated them has been killed (shut down). And I am still trying to find a way to prevent this. </p>