From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Jesús Gómez <jgomo3(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: psql timeout option |
Date: | 2019-06-17 16:06:34 |
Message-ID: | 11831e3c-b9a9-ae87-9452-33eee864987f@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2019-06-17 16:22:21 | Re: Copy Bulk Ignore Duplicated |
Previous Message | Jesús Gómez | 2019-06-17 15:59:18 | psql timeout option |