I have long idle database connection sessions, will they be kept open? Do you use TCP keep-alive?
Currently on the server side we use the default keepalive timeouts:
Note that you can set the client side keepalive timeouts to whatever values you wish. (see https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-KEEPALIVES; the libpq configuration keys are the same as on the server side except that the tcp_ prefix is omitted from the configuration keys)
Even though TCP connections usually stay open for extended periods of time you should also make sure that your application(s) can reconnect since TCP connections are liable to break at times, usually at very inconvenient times at that. Also when reconnecting, you should make sure that your client always resolves the DNS address on connect since the underlying address will change during automatic fail over when a master node fails.