RE: Timeout parameters
Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>
From: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
To: "MikalaiKeida@ibagroup.eu" <MikalaiKeida@ibagroup.eu>
Cc: "AYahorau@ibagroup.eu" <AYahorau@ibagroup.eu>, Fabien COELHO <coelho@cri.ensmp.fr>, "Jamison, Kirk" <k.jamison@jp.fujitsu.com>, "Michael
Paquier" <michael@paquier.xyz>, "Nagaura, Ryohei" <nagaura.ryohei@jp.fujitsu.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Robert Haas <robertmhaas@gmail.com>
Date: 2019-03-15T08:04:20Z
Lists: pgsql-hackers
From: MikalaiKeida@ibagroup.eu [mailto:MikalaiKeida@ibagroup.eu] > In case of failure PQcancel() terminates in 'socket_timeout'. So, control > to the end-user in such a failure situation will be returned in 2 * > 'socket_timeout' interval. It is much better than hanging forever in some > specific cases. Moreover, such solution will not lead to the overloading > of PostgreSQL server by abnormally ignored 'heavy' queries results by > end-users. Oops, unfortunately, PQcancel() does not follow any timeout parameters... It uses a blocking socket. Also, I still don't think it's a good idea to request cancellation. socket_timeout should be sufficiently longer than the usually expected query execution duration. And long-running queries should be handled by statement_timeout which indicates the maximum tolerable query execution duration. For example, if the usually expected query execution time is 100 ms, statement_timeout can be set to 3 seconds and socket_timeout to 5 seconds. Regards Takayuki Tsunakawa
Commits
-
Add support TCP user timeout in libpq and the backend server
- 249d64999615 12.0 landed