Is it possible to set keepalives_idle
parameter in .psqlrc
so that every connection I open uses it?
I've finally found this option and it's a remedy for my connection dropping problems.
I would really like to set it globally for all sessions I open with psql
.
Best Answer
With TCP Keepalives, it doesn't matter who sends it and who receives it. It just matters that it happened so the route isn't lost by a NAT device or closed at either end. I don't know why you'd ever want to set this on the client, as libpq offers, both methods accomplish the same thing.
How to set keepalive transmissions from the server
This only sets it for your session
To set the
tcp_keepalives_idle
from the server to the client, useYou can put anything you want in your
~/.psqlrc
and it gets executed by psql (except under-c
and-x
). So append this command to the end if you want it to occur for ever psql session.How do set keepalive transmissions from the client
According to this mailing list post, you can set it on the client by typing