Thread: psql timeout option
Hello!
Does the psql command have a timeout option for network connections?
On 6/17/19 8:59 AM, Jesús Gómez wrote: > Hello! > > Does the psql command have a timeout option for network connections? Something like below? If not you will need to be more specific https://www.postgresql.org/docs/11/app-psql.html From within psql: \c or \connect \c "host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable" Borrowing from above for initial connection psql "host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable" Where connect_timeout is: https://www.postgresql.org/docs/11/libpq-connect.html#LIBPQ-CONNSTRING "connect_timeout Maximum wait for connection, in seconds (write as a decimal integer, e.g. 10). Zero, negative, or not specified means wait indefinitely. The minimum allowed timeout is 2 seconds, therefore a value of 1 is interpreted as 2. This timeout applies separately to each host name or IP address. For example, if you specify two hosts and connect_timeout is 5, each host will time out if no connection is made within 5 seconds, so the total time spent waiting for a connection might be up to 10 seconds. " -- Adrian Klaver adrian.klaver@aklaver.com